Setup
Argyle iOS SDK provides a way to integrate Argyle Link into your iOS app. Requirements:- iOS 12.0+
- Xcode 12.0+
- Swift 5+
Argyle recommends that you lock your app to portrait orientation.
Adding the SDK dependency
You can add the SDK dependency with Swift Package Manager or CocoaPods.Swift Package Manager
Swift Package Manager, or SwiftPM, is a tool for managing the distribution of Swift code. It is integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. To integrate Argyle Link into your Xcode project using SwiftPM follow the Apple documentation. Search for theargyle-link-ios package and use the version-based package requirements.
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Argyle into your Xcode project using CocoaPods, specify it in yourPodfile:
pod 'Argyle', '4.x.x'
Use pod install and pod update commands to install/update pods afterward.
Configuring and starting the flow
ReplaceYOUR_LINK_KEY with your own Link key. Find your Link key in the Link keys section of Argyle Console.
iOS SDK configuration:
The
apiHost in this iOS SDK configuration example is set to the Argyle Sandbox API (https://api-sandbox.argyle.com/v1). It’s a good idea to test your implementation in Sandbox mode first, then change this to the Production API (https://api.argyle.com/v1) when you are ready to go live.Closing Link programmatically
Normally, the user closes Link but you can also close it by callingArgyle.shared.close().
We strongly recommend upgrading the SDK as soon as there is a new version available. This helps you provide the best Argyle Link experience in your application.
Configuration
Argyle Link provides multiple configuration options and callbacks that customize how this UI element functions in your application. The only argument that is mandatory when invoking Argyle Link is the Link key, which you can find in Argyle Console. By default, anytime Argyle Link is initialized, it will be treated as a new session for a new user. To ensure your users retain their previous state in Argyle Link when it is re-initialized for them, your application must use theuserToken parameter.
For a full list of Link configuration parameters, see the Link reference.
User tokens
User tokens are temporary access keys that let you start Argyle Link for an existing user. Tokens are short-lived. Generate a new token using the API every time you initialize Argyle Link for a returning user. You can create user tokens using the/user-tokens endpoint.
Make sure that you request user tokens on your server-side and your client_id and client_secret are never exposed on the front-end.