main navigation

Products

Support

Language

Recipe: Sample UI for Login

Author: Ian WardLanguage: SwiftDate: September 1, 2017

The LoginKit can be pulled into your app to prompt the user for credentials and then use those credentials to open a synced Realm. User credentials are required to open a synced realm although they could be hardcoded into your app if your app does not require users to log in.

Example Code

Swift

// Create the objectletloginController=LoginViewController(style:.lightTranslucent)// init() also defaults to lightTranslucent// Configure any of the inputs before presenting itloginController.serverURL="localhost"// Set a closure that will be called on successful loginloginController.loginSuccessfulHandler={userin// Provides the successfully authenticated SyncUser object}