NowVoiceThemeable protocol - iOS
Sets the colors to apply to NowVoice UI elements.
To match the voice UI to your app's visual identity, create a type conforming to NowVoiceThemeable and pass it to NowVoiceService - startVoice(endpoint:uiConfiguration:callbacks:theme:) or NowVoiceService - updateTheme(theme:).
| Name | Type | Description |
|---|---|---|
| color | NowUIColoring | Colors to apply to NowVoice UI elements. |
This example shows how to apply custom app colors to the voice UI.
import NowVoice
let instanceUrl = URL(string: "https://your-instance.service-now.com")!
do {
let voiceService = try await NowVoice.makeVoiceService(instanceUrl: instanceUrl)
} catch {
// Handle NowServiceError (see Error reference below)
print("Failed to create voice service: \(error)")
}
struct MyVoiceTheme: NowVoiceThemeable {
var color: NowUIColoring = MyAppColors()
}
// Apply at voice session launch
let vc = try await voiceService.startVoice(endpoint: endpoint, theme: MyVoiceTheme())
// Or update while a voice session is active
voiceService.updateTheme(theme: MyVoiceTheme())