ForgeRock Developer Experience

Step 3. Initialize the SDK

  1. In your ViewController.swift file, import the FRAuth module:

    //
    //  ViewController.swift
    //  DemoApp
    //
    
    import UIKit
    import FRAuth
    
    class ViewController: UIViewController {
    
       override func viewDidLoad() {
         super.viewDidLoad()
         // Do any additional setup after loading the view.
       }
    }

    You can now start using the SDK.

  2. Initialize the SDK with the FRAuth.start() method.

    This enables you to verify that the SDK is working correctly. To catch any errors, add a print statement to confirm that the SDK is initialized.

    In ViewController.swift, add the following call to the viewDidLoad() method:

    do {
       try FRAuth.start()
       print("SDK initialized successfully")
    
    }
    catch {
       print(error)
    }

    Your complete viewController.swift file should now resemble the following:

    //
    //  ViewController.swift
    //  DemoApp
    //
    //
    
    import UIKit
    import FRAuth
    
    class ViewController: UIViewController {
    
       override func viewDidLoad() {
           super.viewDidLoad()
           // Do any additional setup after loading the view.
    
           do {
               try FRAuth.start()
               print("SDK initialized successfully")
            }
            catch {
               print(error)
            }
       }
    }
  3. Save your changes.

    You should now be able to use the SDK in your project.