Recipe: Sample UI for Login

Author: Ian Ward
Language: Objective-C
Date: 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


// Create the object
RLMLoginViewController *loginController = [[RLMLoginViewController alloc] initWithStyle:LoginViewControllerStyleLightTranslucent];

// Configure any of the inputs before presenting it
loginController.serverURL = @"localhost";

// Set a closure that will be called on successful login
loginController.loginSuccessfulHandler = ^(RLMSyncUser *user) {
	// Provides the successfully authenticated RLMSyncUser object


  • Light & dark themes for light apps like Realm Draw, and dark apps like Realm Tasks.
  • Fully adaptive to both smartphone, and tablet screen sizes.
  • Easy swapping between ‘log in’ and ‘sign up’ modes.
  • Optional settings to hide the server URL and ‘remember me’ form fields.
  • The ability to remember username and passwords on subsequent app launches.

Get Realm LoginKit

  • Xcode 8.0 and up
  • iOS 9.0 and up

Looking for the Swift version? Find it here.