UserServiceDataModel
@objc public class UserServiceDataModel: NSObject
Manages all the UserService manifest configuration data.
-
Bank values are special in that the server sets / gets them as a single bulk operation. As such a game can use the special ‘bank’ key to denote getting / setting all bank values in a single operation with the server.
Declaration
Swift
public static let KEY_TYPE_ALL_BANK = "bank" -
The shared singleton instance.
Declaration
Swift
public static var instance: UserServiceDataModel -
Reset the instance, it will need to be reinitialized before it can be used again.
Declaration
Swift
public static func reset() -> Void -
Undocumented
Declaration
Swift
public private(set) var fetchConfig: [String: [String]] = [:] -
A flag that is true if the UserServiceDataModel has successfully initialized.
Declaration
Swift
public private(set) var initialized: Bool = false -
Initialize the service.
Declaration
Swift
public func initialize() -> Promise<Response>Return Value
A
Promise<Response>that resolves when successfully initialized. Will fail if there are errors in the manifest ‘userService’ node. -
Get an item config for type / key.
Declaration
Swift
public func getItemConfig<T: IUserServiceItem>(type: ItemType, key: String, value: T.Value? = nil) throws -> T?Parameters
typeThe
ItemType.keyThe key of the item.
valueThe optional value to assign into the config when returned.
Return Value
IUserServiceItem. Will be nil if the type or key are invalid / don’t exist. -
Get the
ItemTypefor a given key.Throws
DarkMatterErrorCode.Uninitializedif the service is uninitialized.Declaration
Swift
public func getItemTypeForKey(key: String) throws -> ItemType?Parameters
keyThe key to check.
Return Value
ItemType. nil if the key is invalid or not found.
UserServiceDataModel Class Reference