Pre-Built UI
Leverage our Pre-Built UI for rapid integration and customization of authentication flows in your application. This setup allows you to adjust appearance and functionality through the OTPLESS dashboard with minimal coding.
Step 1: SDK Installation
SDK can be installed via both Cocoapods and Swift Package Manager.
Please find the latest version of the SDK here.
Cocoapods
- Open your app’s project file
.xcodeproj
. - Add the following line into the dependencies section of your project’s
Podfile
:
Make sure to run the following commands in your root folder to fetch the dependency.
Swift Package Manager
- In Xcode, click File > Swift Packages > Add Package Dependency.
- In the dialog that appears, enter the repository URL: https://github.com/otpless-tech/iOS-LP.
- Select the dependency rule as
exact version
and use the latest version.
Step 2: Setup SDK in your App
Add the following keys in your info.plist
file:
Import the SDK at the top of your ViewController.swift
:
Step 3: Implement the ConnectResponseDelegate
Your ViewController
should conform to ConnectResponseDelegate
:
Step 4: Initialize the SDK, Set Delegate and Start
Set the response delegate and optionally enable socket logging:
To start the authentication process, use:
Step 5: Stop the process
When your login page is closed or login is successful, stop the Otpless’ authentication process:
Make sure that initialize()
is called again if you call cease()
.