Collecta SDK
Requirements
- iOS 10.0+
- Xcode 10.2+
- Swift 5+
Installation
Using CocoaPods
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Our SDK into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'CollectaSdk'Then install the pods using pod install --repo-update
Usage
Initialize Collecta SDK in your app
You can add CollectaSDK initialization code to your application either at startup ,or at the desired point in your application flow. Import the CollectaSdk module and configure a shared instance as shown:
-
Import the CollectaSdk module in your
UIApplicationDelegate:import CollectaSdk
-
Configure a CollectaSdk shared instance, typically in your app's
application(_:didFinishLaunchingWithOptions:)method:CollectaSdk.shared.initialize(username:"your-user-name", password: "your-password", source:"source-1", uuid:"user-id")
Parameters:
username-> username we providepassword-> password we providesource-> source we provideuuid-> unique id for the user
-
To respond to the delivery of notifications, you must implement a delegate for the shared
UNUserNotificationCenterobject inapplication(_:didFinishLaunchingWithOptions:):UNUserNotificationCenter.current().delegate = self
-
Your delegate object must conform to the
UNUserNotificationCenterDelegateprotocol ,and implement theuserNotificationCenter(_:didReceive:withCompletionHandler:)anduserNotificationCenter(_:willPresent:withCompletionHandler:)methods.func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { CollectaSdk.shared.userNotificationCenter(didReceive:response) completionHandler() } func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler:@escaping(UNNotificationPresentationOptions)->Void) { completionHandler([.alert,.sound,.badge]) }
Send Current User Location
You can send current user location using sendLocation(lat:lng) method in any time you want ,We recommend using this method wherever your app get the user's location:
func locationManager(_ manager: CLLocationManager,
didUpdateLocations locations: [CLLocation]) {
let location = locations.last!
let lat = location.coordinate.latitude
let lng = location.coordinate.longitude
CollectaSdk.shared.sendLocation(lat:lat, lng:lng)
}Credits
Collecta SDK is owned and maintained by the MEDRICS Healthcare Solutions Corp. You can follow us on Linkedin at MEDRICS for project updates and releases.
Copyright
Copyright © 2020 MEDRICS Healthcare Solutions Corp. All rights reserved.
