Files
rive-ios/Source/Renderer/include/Rive.h
luigi-rosso 27de5abf4b Ios out of band
few bits to sort out
- [x] make our mix of simulator/emulator consistent, settling on emulator
- [x] passing the factory in works great for just in time asset decoding, but its not amazing when you want to decode ahead of time.
- [x] couple of places left to pass this function signature through. (Question) is there a neater way to get this done, feels a bit like we are going back to parameter explosion a bit?
- [x] should do a few examples, i think the complexity grows quite a bit in this one as you add caching, or callbacks
- [x] should get the cached images/fonts to draw on init as well, either warming up cache, or jitting
- [x] examples loading assets from the bundle (also there seem to be actual asset things too? should we use those?!)
- [x] add test
- [x] re-add "preview" project & rev the preview project once this has been deployed. (do this after new ios deploy)
- [x] fix up race condition (see comment)

https://github.com/rive-app/rive/assets/1216025/2c14330f-e8a4-481b-bc27-4807cabe3b82

(simple example, both swift ui and standard)

![CleanShot 2023-11-20 at 16 54 59](https://github.com/rive-app/rive/assets/1216025/a71e207c-30ad-44dd-9e4b-ad7431b22186)

Diffs=
fabb7f97f Ios out of band (#6232)

Co-authored-by: Gordon Hayes <pggordonhayes@gmail.com>
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-12-05 21:23:08 +00:00

101 lines
2.2 KiB
Objective-C

//
// RiveFile.h
// RiveRuntime
//
// Created by Matt Sullivan on 8/30/20.
// Copyright © 2020 Rive. All rights reserved.
//
#ifndef rive_h
#define rive_h
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <RiveRuntime/RiveFile.h>
#import <RiveRuntime/RiveArtboard.h>
#import <RiveRuntime/RiveSMIInput.h>
#import <RiveRuntime/RiveLinearAnimationInstance.h>
#import <RiveRuntime/RiveStateMachineInstance.h>
#import <RiveRuntime/RiveTextValueRun.h>
#import <RiveRuntime/RiveEvent.h>
#import <RiveRuntime/LayerState.h>
#import <RiveRuntime/RenderContextManager.h>
// TODO: fix our headers so these can become exposed here
#import <RiveRuntime/RiveFactory.h>
#import <RiveRuntime/RiveFileAsset.h>
#import <RiveRuntime/RiveFileAssetLoader.h>
#import <RiveRuntime/CDNFileAssetLoader.h>
NS_ASSUME_NONNULL_BEGIN
/*
* LoopMode
*/
typedef NS_ENUM(NSInteger, RiveLoop) { oneShot, loop, pingPong, autoLoop };
/*
* Direction
*/
typedef NS_ENUM(NSInteger, RiveDirection) {
backwards,
forwards,
autoDirection,
};
/*
* Fits
*/
typedef NS_ENUM(NSInteger, RiveFit) { fill, contain, cover, fitHeight, fitWidth, scaleDown, noFit };
/*
* Alignments
*/
typedef NS_ENUM(NSInteger, RiveAlignment) {
topLeft,
topCenter,
topRight,
centerLeft,
center,
centerRight,
bottomLeft,
bottomCenter,
bottomRight
};
FOUNDATION_EXPORT NSString* const RiveErrorDomain;
typedef NS_ENUM(NSInteger, RiveErrorCode) {
RiveNoArtboardsFound = 100,
RiveNoArtboardFound = 101,
RiveNoAnimations = 200,
RiveNoAnimationFound = 201,
RiveNoStateMachines = 300,
RiveNoStateMachineFound = 301,
RiveNoStateMachineInputFound = 400,
RiveUnknownStateMachineInput = 401,
RiveNoStateChangeFound = 402,
RiveUnsupportedVersion = 500,
RiveMalformedFile = 600,
RiveUnknownError = 700,
};
/*
* RiveRenderer
*/
@interface RiveRenderer : NSObject
- (instancetype)initWithContext:(nonnull CGContextRef)context;
- (void)alignWithRect:(CGRect)rect
withContentRect:(CGRect)contentRect
withAlignment:(RiveAlignment)alignment
withFit:(RiveFit)fit;
@end
typedef bool (^LoadAsset)(RiveFileAsset* asset, NSData* data, RiveFactory* factory);
NS_ASSUME_NONNULL_END
#endif /* rive_h */