Welcome to Milo SDK's Wiki!
Here you can find information about how to integrate Milo SDK with your app.
- iOS 11.0+
- Xcode 10.2+
- Swift 5+
- In case you have any issues please contact [email protected]
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate MiloSdk into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'MiloSdk'
Right click on Info.plist and click "Open As" -> "Source Code". Add the below strings (ignore if you already have these) -
<key>NSCameraUsageDescription</key>
<string>Allow app to access this device's camera to upload profile picture & create posts.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Allow app to access this device's photo library to upload profile picture & create posts.</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>miloapp</string>
</array>
Open AppDelegate.swift
import MiloSdk
let miloClientSecret = ""
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
...
MiloSDK.shared.setClientSecret(clientSecret)
MiloSDK.shared.setPhoneNumber("9887156125")
MiloSDK.shared.setEmail("[email protected]")
MiloSDK.shared.setFirstName("Luke")
MiloSDK.shared.setLastName("Skywalker")
MiloSDK.shared.setGender("male")
MiloSDK.shared.setDateOfBirth("10-07-1972")
MiloSDK.shared.initializeMiloSDK()
...
...
return true
}
clientSecret - Mandatory field. Request the client secret from [email protected] or use you the SDK dashboard to create client secrets.
phoneNumber - Either phone number or email is mandatory. Pass a string field, can contain country code.
email - Either email or phone number is mandatory. Pass a valid email address in string format.
firstName - Mandatory field. String field which accepts users' first name.
lastName - Optional field. String fields which accept users' last name.
gender - Optional field. Either 'male' or 'female' can be passed to identify the users' gender.
dateOfBirth - Optional field. This is a string field with the date format dd-mm-yyyy
On the controller where you'd like to open the Milo screen
import UIKit
import MiloSdk
class ViewController: UIViewController {
@IBOutlet weak var vWForMiloBtn: UIView!
var btnMilo: MiloButton!
override func viewDidLoad() {
super.viewDidLoad()
...
...
btnMilo = MiloButton.init(frame: CGRect.init(x: 0, y: 0, width: 120, height: 120))
btnMilo.addTarget(self, action: #selector(btnMiloSdkOnClick), for: UIControl.Event.touchUpInside)
vWForMiloBtn.addSubview(btnMilo)
...
...
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
btnMilo.frame = CGRect.init(x: 0, y: 0, width: 120, height: 120)
}
@objc func btnMiloSdkOnClick() {
if let vc = MiloSDK.shared.getMainVC() {
let navVC = UINavigationController.init(rootViewController: vc)
// Always set `Milo MainVc` in `NavigationController` and use 'present' method, do not use 'push' method, because 'back' action is handled only for 'present'.
present(navVC, animated: true, completion: nil)
}
}
}
If you believe you have identified a security vulnerability with MiloSdk, you should report it as soon as possible via email to [email protected].
Please use only the methods and UI components documented in this Wiki, do not use any of the undocumented methods although they may be exposed via any of the SDK classes.