In order to use Gameball you must configure a GameballApp.
Import our pod to your viewController
Create a global GameballApp variable in your viewController to access anywhere within your viewController
var gameballApp: GameballApp?
In your viewControlller viewDidLoad() method add this
//Change the APIKEY , Language , player ID based on your referenceslet gameball = GameballApp.init(APIKey: "xxxxxxxxxxxxxxx", lang: "en")self.gameballApp = gameball
The below is description of Initialization params
Your Gameball unique client API Key
Your platform language preference to view Gameball Widget with. If not provided, Gameball app will appear in English.
Register player method is used to create or update the player at Gameball. Ideally its called when your login network call is successful.
let playerAttributes: [String : Any] = ["displayName": "Martin spiderman","email": "firstname.lastname@example.org","gender": "m","mobileNumber": "01280448448","dateOfBirth": "2019-08-18T10:11:34.478Z","joinDate": "2019-08-18T10:11:34.478Z","custom" : ["customAttribute1": "string","customAttribute2": 0,"customAttribute3": "2019-09-19T21:06:29.158Z","customAttribute4": true //boolean values (true or false)]]self.gameballApp?.registerPlayer(withPlayerUniqueId:playerUniqueId, withPlayerTypeId: playerTypeId,withPlayerAttributes: playerAttributes, withDeviceToken: deviceToken)
PlayerUniqueId is a unique ID for you user, for example UUID or username. The PlayerUniqueId is to be provided by the client and must be unique for each user.
Each player type has an ID
PlayerAttributes is a builder class which is used to add or update your player info to Gameball. Player object is described in Object Reference section.
Mobile device token used for push notifications
Once the APIKey and playerUniqueId have been registered, Gameball views can be made visible to the user