VOGameData

@interface VOGameData : NSObject

VOGameData contains all the data for a game / challenge. It contains data that will stay static (eg. the title of the game), and data that will change based on which VOVoucher it is in (eg. scoreToWin).

  • The type of game.

    Declaration

    Objective-C

    @property (readonly, nonatomic) VOGameType gameType;

    Swift

    var gameType: VOGameType { get }
  • The title of the game.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) NSString *_Nonnull gameTitle;

    Swift

    var gameTitle: String { get }
  • A large local image used in the VOCreateChallengesViewController.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) NSString *imageName;

    Swift

    var imageName: String? { get }
  • A large remote image url used in the VOCreateChallengesViewController.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) NSString *imageUrl;

    Swift

    var imageUrl: String? { get }
  • A small thumbnail image for use in small views.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) NSString *thumbnailImageUrl;

    Swift

    var thumbnailImageUrl: String? { get }
  • A ‘lock’ icon image is used to show that a VOVoucher is locked by a game.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) NSString *_Nonnull lockIconImageUrl;

    Swift

    var lockIconImageUrl: String { get }
  • The current difficulty of a game. The creator of a VOVoucher can change this difficulty from the VOCreateChallengesViewController.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable)
        VOGameDifficulty *gameDifficulty;

    Swift

    var gameDifficulty: VOGameDifficulty? { get }
  • A list of all difficulties this game can have.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable)
        NSArray<VOGameDifficulty *> *gameDifficulties;

    Swift

    var gameDifficulties: [VOGameDifficulty]? { get }
  • The score required to win the game.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSInteger scoreToWin;

    Swift

    var scoreToWin: Int { get set }
  • The seed value used to randomly generate values consistently across devices.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSInteger gameSeed;

    Swift

    var gameSeed: Int { get set }
  • The score the claiming VOUser achieved when claiming the VOVoucher.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSInteger claimerScore;

    Swift

    var claimerScore: Int { get }
  • Whether or not the game can be previewed during the time of creation.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL canPreview;

    Swift

    var canPreview: Bool { get }
  • Whether the game requires landscape orientation.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL isLandscape;

    Swift

    var isLandscape: Bool { get }
  • Initializer that creates a VOGameData that is of type NoGame.

    Declaration

    Objective-C

    + (nonnull VOGameData *)gameDataForNoGame;

    Swift

    class func forNoGame() -> VOGameData

    Return Value

    Instance of VOGameData with gameType = NoGame.

  • Static initializer of VOGameData from a dictionary form. Internally calls initWithDictionary.

    Declaration

    Objective-C

    + (nonnull VOGameData *)gameDataFromDictionary:
        (nonnull NSDictionary *)dictionary;

    Swift

    /*not inherited*/ init(from dictionary: [AnyHashable : Any])

    Parameters

    dictionary

    - dictionary form of the VOGameData.

    Return Value

    Instance of VOGameData with the properties from dictionary.

  • Default initializer of VOGameData from a dictionary form.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDictionary:(nonnull NSDictionary *)dictionary;

    Swift

    init(dictionary: [AnyHashable : Any])

    Parameters

    dictionary

    - dictionary form of the VOGameData.

    Return Value

    Instance of VOGameData with the properties from dictionary.

  • Converts a string to enum VOGameType.

    Declaration

    Objective-C

    + (VOGameType)stringToGameType:(nonnull NSString *)gameType;

    Swift

    class func string(toGameType gameType: String) -> VOGameType

    Parameters

    gameType

    - string value of the VOGameType.

    Return Value

    VOGameType enum value. VOUnknownGame if it cannot determine from the string.

  • Converts a VOGameType enum to a string.

    Declaration

    Objective-C

    + (nonnull NSString *)gameTypeToString:(VOGameType)gameType;

    Swift

    class func gameType(toString gameType: VOGameType) -> String

    Parameters

    gameType

    - VOGameType enum value.

    Return Value

    string version of VOGameType.

  • Sets the current game difficulty for the VOGameType to that difficultyLevel.

    Declaration

    Objective-C

    - (void)setGameDifficultyLevel:(VOGameDifficultyLevel)difficultyLevel;

    Swift

    func setGameDifficultyLevel(_ difficultyLevel: VOGameDifficultyLevel)

    Parameters

    difficultyLevel

    - the desired difficulty for the game.

  • Converts a VOGameData to an NSDictionary that can be used for caching or sending to the server.

    Declaration

    Objective-C

    - (nonnull NSDictionary *)dictionaryRepresentation;

    Swift

    func dictionaryRepresentation() -> [AnyHashable : Any]

    Return Value

    dictionary - Dictionary form of a VOGameData.