ConfigBuilder
@available(iOS 12.0, *)
public class ConfigBuilder
A builder that constructs Kaleyra Video SDK Config objects.
This object helps you creating Config objects guiding you in this process with a fluent interface.
The only required parameters are the appID, the environment and the region values. You must provide those values
in the builder initialiser, then you can use the builder methods to enable or disable tools and other SDK features.
try ConfigBuilder(appID: "my app id", environment: .production, region: .europe)
.callKit { callkit in
callkit.enabled { providerBuilder in
providerBuilder.supportedHandles([.generic])
.ringtoneSound("ringtone.mp3")
.icon(UIImage(named: "callkit-icon")!)
}
}
.voip { voip in
voip.automatic(pushRegistryDelegate: self)
}
.tools { tools in
tools.chat()
.whiteboard(uploadEnabled: true)
.fileshare()
.inAppScreenSharing()
.broadcastScreenSharing(appGroupIdentifier: "group.com.acme.Acme",
broadcastExtensionBundleIdentifier: "com.acme.Acme.BroadcastExtension")
}
.disableDirectIncomingCalls()
.hijackAudioRoute(.always)
.build()
By default the builder will use some default values if you don’t override them by calling one of its methods. Here’s a list of the default values:
- CallKit is enabled
- VoIP notifications are NOT handled automatically, you must handle them yourself
- All tools are disabled
- Camera configuration has cameraPosition set to
front - The SDK will listen for direct incoming calls coming from the WebSocket connection
The
SpeakerHijackingStrategyisSpeakerHijackingStrategy.videoForeground.Remark
This builder is suited and available only forSwiftcode. If your application is written inObjective-c, you should use theBDKConfigBuilderinstead.
-
Creates a new instance of the builder that will help you out building a Kaleyra Video
Configobject.You are required to provide a appID, environment, region triplet identifying your app in the Kaleyra Video platform. Beware, the appID is bound to an environment and a region, if you provide a wrong environment or region value the Kaleyra Video won’t be able to connect to the back-end.
Important
You cannot setup one app to connect to
Europeregion and another one toIndiaregion, they won’t talk to each other.Declaration
Swift
public init(appID: String, environment: Bandyer.Environment, region: Bandyer.Region)Parameters
appIDThe appID identifying your app in the Kaleyra Video platform.
environmentKaleyra Video back-end environment where the SDK will connect to (e.g production, sandbox).
regionThe global region where user’s data will be conserved and managed.
-
A method that will let you specify CallKit configuration values.
Call this method when you want to override CallKit configuration default values using an inline build closure. The closure will provide a
CallKitConfigurationBuilderyou may use to enable or disable the SDK CallKit support by calling one of its methods.let config = try ConfigBuilder(appID: "my app id", environment: .production, region: .europe) .callKit { callkit in callkit.enabled { providerConfig in providerConfig .supportedHandles([.phoneNumber, .emailAddress]) .ringtoneSound("my ringtone.mp3") .icon(UIImage(named: "callkit.png")!) } }.build()The
CallKitConfigurationBuilderbuilder provided in the closure will store the CallKit configuration values you provide and it will eventually apply them to the finalConfigobject when theConfigBuilder.buildmethod is invoked.Remark
Calling this method several times discards the previously provided values
Declaration
Swift
public func callKit(_ build: (CallKitConfigurationBuilder) throws -> Void) rethrows -> ConfigBuilderParameters
buildA non escaping closure you provide to build the CallKit configuration using the builder provided as closure argument.
Return Value
self after storing the configuration values you provided.
-
A method that will let you specify CallKit configuration values.
Call this method when you want to override CallKit configuration default values providing a
CallKitConfigurationBuilder. TheCallKitConfigurationBuilderbuilder provided will store the CallKit configuration values you provide and it will eventually apply them to the finalConfigobject when theConfigBuilder.buildmethod is invoked.Declaration
Swift
public func callKit(_ builder: CallKitConfigurationBuilder) -> ConfigBuilderParameters
builderThe
CallKitConfigurationBuilderobject you want to use for configuring CallKit.Return Value
self after storing the
CallKitConfigurationBuilderobject.
-
A method that will let you specify VoIP push configuration values.
Call this method when you want to setup how the Kaleyra Video SDK should manage VoIP push notifications using an inline build closure. The closure will provide a
VoIPPushConfigurationBuilderyou may use to select which strategy the SDK should use for handling VoIP notifications by calling one of its methods.let config = try ConfigBuilder(appID: "my app id", environment: .production, region: .europe) .voip { voip in voip.automatic(pushRegistryDelegate: self) }.build()The
VoIPPushConfigurationBuilderbuilder provided in the closure will store the configuration values you provide and it will eventually apply them to the finalConfigobject when theConfigBuilder.buildmethod is invoked.Remark
Calling this method several times discards the previously provided values
Declaration
Swift
public func voip(_ build: (VoIPPushConfigurationBuilder) throws -> Void) rethrows -> ConfigBuilderParameters
buildA non escaping closure you provide to build the VoIP configuration using the builder provided as closure argument.
Return Value
self after storing the configuration values you provided.
-
A method that will let you specify VoIP push configuration values.
Call this method when you want to setup how the Kaleyra Video SDK should manage VoIP push notifications. Call this method when you want to setup how the Kaleyra Video SDK should manage VoIP push notifications providing a
VoIPPushConfigurationBuilder. TheVoIPPushConfigurationBuilderbuilder provided will store the VoIP configuration values you provide and it will eventually apply them to the finalConfigobject when theConfigBuilder.buildmethod is invoked.Declaration
Swift
public func voip(_ builder: VoIPPushConfigurationBuilder) -> ConfigBuilderParameters
builderThe
VoIPPushConfigurationBuilderobject you want to use for configuring how the SDK will handle VoIP notifications.Return Value
self after storing the configuration values you provided.
-
A method that will let you enable the Kaleyra Video collaboration tools.
Call this method when you want to setup the Kaleyra Video SDK tools using an inline build closure. The closure will provide a
ToolsConfigurationBuilderyou may use to select which SDK tools should be enabled by calling one of its methods.let config = try ConfigBuilder(appID: "my app id", environment: .production, region: .europe) .tools { tools in tools.chat() .inAppScreenSharing() .whiteboard(uploadEnabled: true) }.build()The
ToolsConfigurationBuilderbuilder provided in the closure will store the configuration values you provide and it will eventually apply them to the finalConfigobject when theConfigBuilder.buildmethod is invoked.Remark
Calling this method several times discards the previously provided values
Declaration
Swift
public func tools(_ build: (ToolsConfigurationBuilder) throws -> Void) rethrows -> ConfigBuilderParameters
buildA non escaping closure you provide to setup the Kaleyra Video SDK tools using the builder provided as closure argument.
Return Value
self after storing the configuration values you provided.
-
A method that will let you enable the Kaleyra Video collaboration tools.
Call this method when you want to setup the Kaleyra Video SDK tools using a
ToolsConfigurationBuilderbuilder. TheToolsConfigurationBuilderbuilder provided will store the tools configuration values you provide and it will eventually apply them to the finalConfigobject when theConfigBuilder.buildmethod is invoked.Declaration
Swift
public func tools(_ builder: ToolsConfigurationBuilder) -> ConfigBuilderParameters
builderThe
ToolsConfigurationBuilderobject you want to use for configuring the SDK tools.Return Value
self after storing the configuration values you provided.
-
A method that will let you create the camera configuration used by the Kaleyra Video SDK.
Call this method when you want to setup the Kaleyra Video SDK camera configuration using an inline build closure. The closure will provide a
CameraConfigurationBuilderyou may use to select which camera configuration you desire.let config = try ConfigBuilder(appID: "my app id", environment: .production, region: .europe) .camera { camera in camera.withCameraPosition(.back) }.build()The
CameraConfigurationBuilderbuilder provided in the closure will store the configuration values you provide and it will eventually apply them to the finalConfigobject when theConfigBuilder.buildmethod is invoked.Remark
Calling this method several times discards the previously provided values
Declaration
Swift
public func camera(_ build: (CameraConfigurationBuilder) throws -> Void) rethrows -> ConfigBuilderParameters
buildA non escaping closure you provide to setup the Kaleyra Video SDK camera configuration using the builder provided as closure argument.
Return Value
self after storing the configuration values you provided.
-
A method that will let you create the camera configuration used by the Kaleyra Video SDK.
Call this method when you want to setup the Kaleyra Video SDK camera configuration using a
CameraConfigurationBuilderbuilder. TheCameraConfigurationBuilderbuilder provided will store the camera configuration values you provide and it will eventually apply them to the finalConfigobject when theConfigBuilder.buildmethod is invoked.Declaration
Swift
public func camera(_ camera: CameraConfigurationBuilder) -> ConfigBuilderParameters
builderThe
CameraConfigurationBuilderobject you want to use for configuring the SDK camera configuration.Return Value
self after storing the configuration values you provided.
-
A method that will let you specify the strategy the Kaleyra Video will use to override the audio output to the speaker when a call starts.
The option provided will be used only when the app is running on devices mounting an ear speaker and a loud speaker (iPhones). On devices not supporting ear speaker (iPads) this option has no effect.
let config = try ConfigBuilder(appID: "my app id", environment: .production, region: .europe) .hijackAudioRoute(.always) .build()Remark
Calling this method several times discards the previously provided values
Declaration
Swift
public func hijackAudioRoute(_ strategy: SpeakerHijackingStrategy) -> ConfigBuilderParameters
strategyThe
SpeakerHijackingStrategyyou want to use.Return Value
self after setting the
SpeakerHijackingStrategyvalue.
-
A method that will let you disable incoming calls coming from the WebSocket connection. Call this method when you want to prevent the SDK from receiving incoming calls from the WebSocket connection.
Declaration
Swift
public func disableDirectIncomingCalls() -> ConfigBuilderReturn Value
self after disabling direct incoming calls.
-
Call this method when you have finished setting up the tools and the features of the Kaleyra Video SDK and you want to create a
Configobject.Throws
Throws an error when a configuration object cannot be createdDeclaration
Swift
public func build() throws -> ConfigReturn Value
A
Configobject holding the configuration values you provided to the builder
View on GitHub
ConfigBuilder Class Reference