GameFactory
@interface GameFactory : NSObject
GameFactory produces UIViewControllers that conform to GameViewControllerProtocol for the specified types.
GameFactory communicates with the VoucherCreationFlowDelegate and delegates outside the SDK if necessary.
-
Default initializer of GameFactory.
Declaration
Objective-C
- (nonnull instancetype)initWithDelegate: (nonnull id<VoucherGameDelegate>)delegate;Parameters
delegate- The
VoucherCreationFlowDelegateused to communicate with external objects (outside the SDK).Return Value
Instance of GameFactory.
-
This method is to be called whenever a game view controller is required. This method will return a game view controller from the
VoucherCreationFlowDelegateif one is provided. Otherwise, one will be instantiated based on the provided GameData.Note
This method will throwGameViewControllerNotFoundExceptionif no view controller is found for theGameData.Declaration
Objective-C
- (nullable UIViewController<GameViewControllerProtocol> *) viewControllerForGameData:(nonnull GameData *)gameData vouchrTheme:(nonnull VouchrTheme *)vouchrTheme dialogViewTheme:(nonnull VouchrTheme *)dialogViewTheme loadingView:(nullable id<VouchrLoadingViewProtocol>)loadingView user:(nullable User *)user gameMode:(GameMode)gameMode;Parameters
gameData- The
GameDatathat will be used in the game view controller.vouchrTheme- The theme for the game view controller.
loadingView- A loading view if the game view controller needs to show loading.
user- The creator of the
GameData.gameMode- The current mode of the game. See
GameModefor the different options.Return Value
Instance of a UIViewController that implements
GameViewControllerProtocolfor the providedGameData.
View on GitHub
GameFactory Class Reference