# Usage

## **Initialise the SDK**

The SDK requires to initialise only once when your application starts, we recommend doing this step in AppDelegate

### **Objective-C**

Add the following in your AppDelegate.m:

```objectivec
#import <UqudoSDK/UqudoSDK.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   [[UQBuilderController alloc] init];  
	return YES;
}
```

### **Swift**

Add the Bridging Header to your project. When adding your .m file, you’ll receive a prompt with Yes, No and Cancel buttons. Hit Yes.

<figure><img src="https://1201843429-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0JZZSvL3DmX19a9SgDAt%2Fuploads%2FSAM4ApMy5lutzrwGzU0y%2Fswift.png?alt=media&#x26;token=c2f96ffd-4143-4ed3-aa32-34ec78b16394" alt=""><figcaption></figcaption></figure>

If you don’t see the prompt, or accidentally deleted your bridging header, add a new .h file to your project and name it <#YourProjectName#>-Bridging-Header.h.

Add the following import to your Bridging-Header.h:

```swift
#import <UqudoSDK/UqudoSDK.h>
```

In the AppDelegate.swift, initialize the SDK:

```swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
	UQBuilderController()
	return true
}
```

## Implement Interface

Extend UQBuilderControllerDeleate in your controller where you initiate the SDK.

### **Objective-C**

Import Uqudo SDK header and conform to UQBuilderControllerDeleate:

```objectivec
#import <UqudoSDK/UqudoSDK.h>

@interface YourViewController ()<UQBuilderControllerDelegate>
```

Implement the delegate methods:

```objectivec
- (void)didEnrollmentCompleteWithInfo:(NSString *)info;

- (void)didEnrollmentIncompleteWithStatus:(UQSessionStatus *)status;

- (void)didFaceSessionCompleteWithInfo:(nonnull  NSString *)info;

- (void)didFaceSessionIncompleteWithStatus:(UQSessionStatus *)status;

- (void)didLookupFlowCompleteWithInfo:(NSString *)info;

- (void)didLookupFlowIncompleteWithStatus:(UQSessionStatus *)status;
```

### **Swift**

Conform to UQBuilderControllerDeleate:

```swift
class ViewController: UIViewController, UQBuilderControllerDelegate
```

Implement the delegate methods:

```swift
func didEnrollmentComplete(withInfo info: String) {}

func didEnrollmentIncomplete(with status: UQSessionStatus) {}

func didFaceSessionComplete(withInfo info: String) {}

func didFaceSessionIncomplete(with status: UQSessionStatus) {}

func didLookupFlowComplete(withInfo info: String) {}

func didLookupFlowIncomplete(with status: UQSessionStatus) {}
```
