VouchrEngine
@interface VouchrEngine : NSObject
VouchrEngine
is a singleton that persists and provides access to core manager dependencies.
Note
Usage Notes Initialize the VouchrEngine using thevouchrEngineWithBuilder:
method.
Example:
VouchrEngine *vouchrEngine = [VouchrEngine vouchrEngineWithBuilder:^(VouchrEngineBuilder *builder) {
builder.cacheManager = [CacheManager new];
builder.networkManager = [NetworkManager new];
builder.userManager = [[UserManager 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
User
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
Voucher
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
Merchant
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
User
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) DiscoverManager *_Nonnull discoverManager;
Swift
var discoverManager: DiscoverManager { get }
-
The config associated with this Engine.
Declaration
Objective-C
@property (readonly, nonatomic) VouchrConfig *_Nonnull vouchrConfig;
Swift
var vouchrConfig: VouchrConfig { get }
-
This initializes the
VouchrEngine
with the specified dependencies.Declaration
Objective-C
+ (nonnull instancetype) vouchrEngineWithConfig:(nonnull VouchrConfig *)vouchrConfig builder:(nonnull void (^)(VouchrEngineBuilder *_Nonnull)) builderBlock;
Swift
convenience init(config vouchrConfig: VouchrConfig, builder builderBlock: @escaping (VouchrEngineBuilder) -> Void)
Parameters
builderBlock
A block containing configuration of the
VouchrEngineBuilder
.Return Value
The singleton instance of
VouchrEngine
. -
Returns the singleton instance of the
VouchrEngine
Declaration
Objective-C
+ (nonnull instancetype)instance;
Swift
class func instance() -> Self
Return Value
Singleton instance of VouchrEngine.
-
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.