To install and use the thinkresearch_messenger_ios_swift_sdk
library using Swift Package Manager, follow the steps below:
Important: This package only works on physical devices, not on simulators.
- Open Xcode and navigate to your project.
- Select your project in the Project Navigator.
- Click on the project name in the project and target list.
- Select the
Swift Packages
tab. - Click the
+
button to add a new package. - Enter the repository URL:
https://github.com/PatientOrderSets/thinkresearch_messenger_ios_swift_sdk.git
. - Select the desired version or branch, and then click
Next
. - Select the package products you want to include in your project, and then click
Finish
.
After installation, you can use the thinkresearch_messenger_ios_swift_sdk
library in your project. Follow the example code below to integrate the SDK into your app.
-
Import the SDK in your view controller:
import UIKit import thinkresearch_messenger_ios_swift_sdk
-
Set up the configuration and initialize the SDK:
class ViewController: UIViewController { // Staging workflow var configuration = ChatBotConfiguration( appId: "****************", baseUrl: "test.ca.digital-fr...........com", originURL: "test.ca.digital-fr...........com", lang: "en" ) var chatBotSdk: TRC_Chatbot_SDK? var language = "en" var appIID = "****************" var originValue = "test.ca.digital-fr...........com" var baseURL = "test.ca.digital-fr...........com" override func viewDidLoad() { super.viewDidLoad() } @IBAction func btnClicked(_ sender: UIButton) { sender.isUserInteractionEnabled = false chatBotSdk = TRC_Chatbot_SDK(configuration: configuration, viewController: self) chatBotSdk?.openBot() DispatchQueue.main.asyncAfter(deadline: .now() + 2) { sender.isUserInteractionEnabled = true } } }
- Physical Device Only: This package only works with physical devices and is not supported on simulators.
- Configuration: Make sure to update the configuration parameters (
appId
,baseUrl
,originURL
,lang
) to match your environment.
By following these steps, you can successfully install and integrate the thinkresearch_messenger_ios_swift_sdk
into your iOS project using Swift Package Manager.