---
page_title: Multi-activity Integration
product: EC Headless
platform: iOS
page_source: https://juspay.io/in/docs/ec-headless/ios/resources/multiactivity-integration
llms_txt: https://juspay.io/in/docs/llms.txt
product_llms_txt: https://juspay.io/in/docs/ec-headless/llms.txt
---


# Multi-activity Integration




## iOS



It is suggested to maintain a time of 5 seconds or above in between initiate and process. Occasionally this may not be possible within the same ViewController. This brings up the use case to call initiate and process from different view controllers. The SDK takes a ViewController as input in initiate API of HyperServices. This view controller will be used as a base view controller for any UI in the SDK. To integrate the SDK across multiple view controller, the base view controller must be updated before calling process API of HyperServices.


### **To change the baseViewController:** 




#### Swift Code Snippet:

```swift
hyperInstance.baseViewController = anotherViewController

```

#### Objective-C Code Snippet:

```objective-c
self.hyperInstance.baseViewController = anotherViewController;
```


Similar to the base view controller, the callback block that was passed in initiate can be updated later if the callback needs to handled from different class.


### **To change the callback block:** 




#### Swift Code Snippet:

```swift
hyperInstance.hyperSDKCallback = { [unowned self] response in
    if let data = response {
        let event = data["event"] as? String ?? ""
        if event == "initiate_result" {
            
        } else if event == "process_result" {
            
        }
    }
}
```

#### Objective-C Code Snippet:

```objective-c
self.hyperInstance.hyperSDKCallback = ^(NSDictionary<NSString *,id> * _Nullable data) {
    if (data && data[@"event"]) {
        if ([event isEqualToString:@"initiate_result"]) {

        } else if ([event isEqualToString:@"process_result"]) {

        }
    }      
};
```




---

## See Also

- [Test Resources](https://juspay.io/in/docs/ec-headless/ios/resources/test-resources)
- [Prefetch](https://juspay.io/in/docs/ec-headless/ios/resources/prefetch)
