ios – Using Twilio Voice SDK with SwiftUI


I am developing an IOS application in SwiftUI and I would like to use Twilio SDK to call a mobile number. I found this docs: https://www.twilio.com/docs/voice/sdks/ios/get-started. But this is using CallKit and I the official docs for the SDK only contains Objective-C code snippets. Can somebody help me out with an example of a simple phone calling in a SwiftUI View or a useful document written with SwiftUI?

What I got already:

I already download the TwilioVoice package and started writing the code, but I couldn’t figure out what should the delegate property be in the .connect method.

var params: [String: String] = [:]

params["Mode"] = "Voice"
params["PhoneNumber"] = "phonenumber..."

let connectOptions = ConnectOptions(accessToken: request.token) { builder in
    builder.params = params
    builder.uuid = uuid
}

// call = TwilioVoiceSDK.connect(options: connectOptions, delegate: self) -> the self gives an error cause: Argument type 'PhoneCallView' does not conform to expected type 'CallDelegate'

Thanks in advance for your help!

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img