Navigation

Quick start

This Quick Start guide will walk you through the steps to integrate Rupt into your app Swift. By the end of this guide, you will have a fully working account sharing mechanism integrated on your application.

1. Installation

  1. Download the Rupt SDK binary from this link
  2. Unzip & drag and drop the Rupt.xcframework into your project. iOS package installation image
  3. Select Copy items if needed and click Finish.

2. Import & configure

You can integrate Rupt into your app in two ways:

Option 1: Using ViewControllers or Storyboards

  1. In your AppDelegate, import the Rupt SDK and initialize it with your clientID and useViewController set to true.
    class AppDelegate: UIResponder, UIApplicationDelegate {
      private let rupt = Rupt(clientID: "xxxxx-xxx-xxxx-xxxx-xxxxxxx", useViewController: true)
    }

    replace xxxxx-xxx-xxxx-xxxx-xxxxxxx with your clientID.
  2. In your AppDelegate, set the userID and attach the device to the user in the didFinishLaunchingWithOptions method.
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
          rupt.setUserID("<#user_id#>")
          rupt.attach()
          return true
      }

Option 2: Using SwiftUI

  1. In your top ContentView, import the Rupt SDK and initialize it with your clientID and useViewController set to false or leave it out as it defaults to false.
    struct ContentView: View {
      private let rupt = Rupt(clientID: "xxxxx-xxx-xxxx-xxxx-xxxxxxx", useViewController: false)
    }

    replace xxxxx-xxx-xxxx-xxxx-xxxxxxx with your clientID.
  2. In your ContentView, set the userID and attach the device to the user in the init or onAppear method.
    struct ContentView: View {
      private let rupt = Rupt(clientID: "xxxxx-xxx-xxxx-xxxx-xxxxxxx", useViewController: false)
      init() {
          rupt.setUserID("<#user_id#>")
          rupt.attach()
      }
    }

3. Handle call

If Rupt determines that the user is sharing their account, and you have the Account sharing protection setting enabled, the user will see a challenge to verify they own this account, logout, or create a new account (i.e. stop sharing). Rupt will handle the verification, but you need to handle the logout and account creation.

In your ViewController or SwiftUI View:

rupt.onLogoutCurrentDevice = {
    //TODO: log the user out of this device
}
rupt.onCreateNewAccount = {
    //TODO: logout the current account and guide the user to create a new account
}