VerloopSDK is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "VerloopSDK"
Then, run the following command:
$pod install
- Initialise Verloop in application:didFinishLaunchingWithOptions.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let notificationSettings = UIUserNotificationSettings(types: [UIUserNotificationType.badge, UIUserNotificationType.sound, UIUserNotificationType.alert], categories: nil)
application.registerUserNotificationSettings(notificationSettings)
let config = VerloopConfig.init(subDomain: "name.stage", token: "test");
config.name = "testName"
config.email = "testEmail"
config.msisdn = "testNumber"
Verloop.sharedInstance.register(withConfig: config);
return true
}
- Update the device token in application:didRegisterForRemoteNotificationsWithDeviceToken
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let deviceTokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})
Verloop.sharedInstance.updateDeviceToken(withDeviceToken: deviceTokenString);
}
- Handle notification
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
if Verloop.sharedInstance.isVerloopNotif(wihtNotif: userInfo) {
Verloop.sharedInstance.handleNotif(withNotif: userInfo)
}
}
- Start live chat
Verloop.sharedInstance.showConversation()
Verloop, [email protected]
VerloopSDK is available under the MIT license. See the LICENSE file for more info.