VOEngine
@interface VOEngine : NSObject
VouchrEngine
is a singleton that persists and provides access to core manager dependencies.
Note
Usage Notes Initialize the VOEngine using thevouchrEngineWithBuilder:
method.
Example:
VOEngine *vouchrEngine = [VOEngine vouchrEngineWithBuilder:^(VouchrEngineBuilder *builder) {
builder.cacheManager = [VOCacheManager new];
builder.networkManager = [VONetworkManager new];
builder.userManager = [[VOUserManager alloc] initWithCacheManager:builder.cacheManager
networkManager:builder.networkManager persistManager:nil];
}];
-
Used to make network requests.
Declaration
Objective-C
@property (readonly, strong, nonatomic) id<VONetworkManagerProtocol> _Nonnull networkManager;
Swift
var networkManager: VONetworkManagerProtocol { get }
-
Used to manage anything related to
VOUser
s.Declaration
Objective-C
@property (readonly, strong, nonatomic) id<VOUserManagerProtocol> _Nonnull userManager;
Swift
var userManager: VOUserManagerProtocol { get }
-
Used to manage temporarily caching of objects.
Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) id<VOCacheProtocol> cacheManager;
Swift
var cacheManager: VOCacheProtocol? { get }
-
Used to manage indefinitely storing of objects.
Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) id<VOPersistManagerProtocol> persistManager;
Swift
var persistManager: VOPersistManagerProtocol? { get }
-
Used to manage anything related to
VOVoucher
s.Declaration
Objective-C
@property (readonly, strong, nonatomic) id<VOVoucherManagerProtocol> _Nonnull voucherManager;
Swift
var voucherManager: VOVoucherManagerProtocol { get }
-
Used to manage anything related to
WrappingPaper
s.Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) id<VOWrappingPaperManagerProtocol> wrappingPaperManager;
Swift
var wrappingPaperManager: VOWrappingPaperManagerProtocol? { get }
-
Used to manage anything related to Youtube.
Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) id<VOYoutubeManagerProtocol> youtubeManager;
Swift
var youtubeManager: VOYoutubeManagerProtocol? { get }
-
Used to manage tracking of analytics events.
Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) id<VOAnalyticsManagerProtocol> analyticsManager;
Swift
var analyticsManager: VOAnalyticsManagerProtocol? { get }
-
Used to manage anything related to
VOMerchant
s.Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) id<VOMerchantManagerProtocol> merchantManager;
Swift
var merchantManager: VOMerchantManagerProtocol? { get }
-
Used to manage the different games and challenges a
VOUser
can play.Declaration
Objective-C
@property (readonly, strong, nonatomic) id<VOGameManagerProtocol> _Nonnull gameManager;
Swift
var gameManager: VOGameManagerProtocol { get }
-
Used to manage uploading media.
Declaration
Objective-C
@property (readonly, strong, nonatomic) id<VOMediaUploadManagerProtocol> _Nonnull mediaUploadManager;
Swift
var mediaUploadManager: VOMediaUploadManagerProtocol { get }
-
Used to manage anything related to canned sounds.
Declaration
Objective-C
@property (readonly, strong, nonatomic) id<VOCannedSoundManagerProtocol> _Nonnull cannedSoundManager;
Swift
var cannedSoundManager: VOCannedSoundManagerProtocol { get }
-
Used to manage anything related to discover content.
Declaration
Objective-C
@property (readonly, strong, nonatomic) VODiscoverManager *_Nonnull discoverManager;
Swift
var discoverManager: VODiscoverManager { get }
-
This initializes the
VOEngine
with the specified dependencies.Declaration
Objective-C
+ (nonnull instancetype) vouchrEngineWithConfig:(nonnull VOConfig *)vouchrConfig builder:(nonnull void (^)(VouchrEngineBuilder *_Nonnull)) builderBlock;
Swift
class func vouchrEngine(with vouchrConfig: VOConfig, builder builderBlock: @escaping (VouchrEngineBuilder) -> Void) -> Self
Parameters
builderBlock
A block containing configuration of the
VouchrEngineBuilder
.Return Value
The singleton instance of
VOEngine
. -
Returns the singleton instance of the
VOEngine
Declaration
Objective-C
+ (nonnull instancetype)instance;
Swift
class func instance() -> Self
Return Value
Singleton instance of VOEngine.
-
Returns the authorization token stored in persistence
This method will try and refresh the token if it can’t find one in persistence.
Declaration
Objective-C
- (void)getTokenOnCompletion:(nonnull void (^)(NSString *_Nonnull))onCompletion;
Swift
func getTokenOnCompletion(_ onCompletion: @escaping (String) -> Void)
-
Persists the authorization token.
Declaration
Objective-C
- (void)setToken:(NSString *_Nullable)token;
Swift
func setToken(_ token: String?)
Parameters
token
The authorization token received upon successful login.