Swiftpack.co - ONMO/OnMobileGamification as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ONMO.
ONMO/OnMobileGamification 1.0.2
OnMobile Gamification package which provide the UI components with core
⭐️ 0
🕓 2 weeks ago
iOS
.package(url: "https://github.com/ONMO/OnMobileGamification.git", from: "1.0.2")

Onmobile: Logo

OnMobileGamification

Quick Guide

Learn how to quickly Install, Integrate & Implement the Gamize iOS SDK

Installation

CocoaPods

Gamize iOS SDK can be integrated to any iOS project through CocoaPods. You can refer Cocoapods for more details.

Command to install CocoaPods (If it is not installed on your OS X)

$ sudo gem install cocoapods

To integrate Gamize iOS SDK into your Xcode project using CocoaPods(Use the version number provided to you), specify it in your Podfile:

pod 'OnMobileGamification', 'x.x.x'

Then, run the following command on your project path:

$ pod install

or

$ pod install --repo-update

If, you see the below error :

[!] CocoaPods could not find compatible versions for pod "OnMobileGamification":
  In Podfile:
    OnMobileGamification (<x.x.x>)

None of your spec sources contain a spec satisfying the dependency: `OnMobileGamification (<x.x.x>)`.

Please, do run the below commands:

$ pod repo update
$ pod install

Integration

Import OnMobileGamification

import OnMobileGamification

It is mandatory to register the app bundle identifier with the sdk before using it.

Implementation

Initialization

Summary

Initialization method to start using the framework.

Declaration

static func initialize(
                with authKey: String, 
                and userKey: String, 
                languageCode: String = "en", 
                for environment: APIEnvironment = .production, 
                succedded success: @escaping (() -> ()), 
                failed fail: @escaping ((GamificationError) -> ()))

Parameters

 - authKey : Provide the authentication key to intialize the sdk
 - userKey : Provide the user token to initialize and to connect to fetch the rewards for the user
 - languageCode : Provide the language code to see the content in that localization
 - success : It is a callback to handle the successfull initialization
 - fail : It is a callback to handle the failure of initialization, provides the detailed error to handle

Next Template Details

Summary

Provides next user active template details

Declaration

static func nextTemplateDetail(
                succedded success: @escaping ((GamificationClientCallback) -> ()), 
                failed fail: @escaping ((GamificationError) -> ()))

Parameters

 - success : It is a sucess callback with the required details of next template details in GamificationClientCallback object
 - fail : It is a callback to handle the failure of next active template api, provides the detailed error to handle

User Reward View

Summary

Provides the user active template detailed view to proceed further gamification of particular type.

Declaration

static func userRewardView(
                name: String, 
                didPresent: Binding<Bool> = .constant(false), 
                _ handler: @escaping ((GamificationClientHandler) -> ())) -> some View

Parameters

 - name : Provide the rule name to fetch the details
 - didPresent : Provide the state value when to present or dismiss the template. If true presents the template
 - handler : It is a callback to handle further on client side, for detailed info please check GamificationClientHandler

Leader Board

Summary

Provides leaderboard details for the provide rule name

Declaration

static func leaderBoardFor(
                _ name: String, 
                didPresent: Binding<Bool> = .constant(false)) -> some View

Parameters

 - name : Provide the rule name to fetch the details
 - didPresent : Provide the state value when to present or dismiss the template. If true presents the leadeboard

Object Details

GamificationClientHandler

This is a client handler class to perform the actions based on framework responses.

Instance Properties

var callBackInfo: GamificationClientCallback?

Provides the extra information required to handle or know the detailed info

var callBackListenerType: GamificationCallBackListenerType?

Provides the detail of call back type

var eventListenerType: GamificationEventListenerType?

Provides the detail of event type

Instance Methods

func dismiss()

Dismisses the SDK/Framework view

Enumerations

GamificationCallBackListenerType

Details of the available Callback types

Enumeration Cases

case failed(GamificationError)

Informs the client that the template actions are faliled with an error and provides the error information

case rewardLoose

Informs the client that the template actions are performed and the user loose the reward

case rewardWon

Informs the client that the template actions are performed and the user won the reward

Instance Properties

var message: String

Detailed message for particular callback type

GamificationEventListenerType

Details of the available Event types

Enumeration Cases

case mediaPause

Informs that the audio/video is paused or stopped

case mediaPlay

Informs that the audio/video is started or about to start playing

case sdkClose

Informs that the sdk is close

case sdkOpen

Informs that the sdk is open

Instance Properties

var message: String

Detailed message for particluar event type

GamificationError

Details of all available error types

Enumeration Cases

case errorHandled

Informs the cleint that the error is occured and it is already handled by sdk

case invalidKey

Informs the the authentication key provided is not correct

case invalidUser

Informs the the user key provided is not correct or expired

case noTemplate

Informs the client that the template requested is not supported or the template is not available to user at that moment

case notDefined(String)

Provides the undefined use cases with the error description

case notInitialized

Informs the the intialization is failed by any other scenarios

case unAuthorisedClient

Informs that the client is an unauthorised either the identifier of app is not matched or not registered. Please check with OnMobile to know the identifier or to add the app identifier in sdk

case unknown

Unhandled cases

Instance Properties

var message: String

Detailed message for particluar error type

License

MIT

Copyright

OnMobile Global Limited

Author

Naresh Babu Kommana

GitHub

link
Stars: 0
Last commit: 2 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1.0.2
2 weeks ago

BL Release

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics