Git Product home page Git Product logo

milo-ios-sdk's Introduction

1--3- (1).png

Welcome to Milo SDK's Wiki!

Here you can find information about how to integrate Milo SDK with your app.

Current stable version - 8.0 ezgif-5-eb5c5ee059be.gif

Requirements

  • iOS 11.0+
  • Xcode 10.2+
  • Swift 5+

Communication

Installation

CocoaPods

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'

Initialization

Info.plist file chnages

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&apos;s camera to upload profile picture &amp; create posts.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Allow app to access this device&apos;s photo library to upload profile picture &amp; create posts.</string>


<key>LSApplicationQueriesSchemes</key>
<array>
    <string>miloapp</string>
</array>

Passing parameters and authenticating user

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

Launching the SDK

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)
			}
		}
	}

Security Disclosure

If you believe you have identified a security vulnerability with MiloSdk, you should report it as soon as possible via email to [email protected].

Notes

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.

milo-ios-sdk's People

Contributors

glynk avatar jaleelnazir avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.