Structures
The following structures are available globally.
-
Data model representing a Channel
See moreDeclaration
Swift
public struct CAIChannel : Codable, Identifiable
-
Holds model for a channel preferences
See moreDeclaration
Swift
public struct CAIChannelPreferencesData : Decodable
-
Holds model for a channel preferences menu
See moreDeclaration
Swift
public struct CAIChannelPreferencesMenuData : Decodable
extension CAIChannelPreferencesMenuData: PreferencesMenuData
-
Holds model for a channel menu call to actions
See moreDeclaration
Swift
public struct CAIChannelMenuDataAction : Decodable
extension CAIChannelMenuDataAction: MenuAction
-
Main Data Model for
See moreCAIConversation
.Declaration
Swift
public struct CAIConversationResultData : Decodable
extension CAIConversationResultData: ResponseMessageData
-
Data Model structure for messages returned by CAI platform
See moreDeclaration
Swift
public struct CAIResponseMessageData : Decodable, Identifiable
extension CAIResponseMessageData: Equatable
extension CAIResponseMessageData: MessageData
-
Undocumented
See moreDeclaration
Swift
public struct CAIResponseParticipantData : Decodable
extension CAIResponseParticipantData: SenderInfo
-
Context information for the bot
See moreDeclaration
Swift
public struct MemoryOptions
-
Standard message format returns by CAI platform Raw format parsed as-is from what the backend system returns
See moreDeclaration
Swift
public struct UIModelData : Decodable
extension UIModelData: ListMessageData
extension UIModelData: FormMessageData
extension UIModelData: ButtonsMessageData
extension UIModelData: CarouselMessageData
-
Undocumented
See moreDeclaration
-
Undocumented
See moreDeclaration
-
Undocumented
See moreDeclaration
Swift
public struct UIModelDataImage : Decodable
-
Holds the content for a specific UIModelData. Properties will be filled based on UIModelData type.
See moreDeclaration
Swift
public struct UIModelDataContent : Decodable
extension UIModelDataContent: ObjectMessageData
extension UIModelDataContent: CarouselItemMessageData, CardMessageData
-
Undocumented
See moreDeclaration
-
Enum CAIError. Implement SAPError. Raised when something is wrong with our platform services.
See moreDeclaration
Swift
public struct CAIError : SAPError, Equatable
-
CAI Service definition. Helps to connect to CAI services. By default, it will connect to Community tenant.
See moreDeclaration
Swift
public struct CAIServiceConfig
-
Casual Color Palette
See moreDeclaration
Swift
public struct CasualColorPalette : ColorPalette
-
Fiori Color Palette. Follows SAP Fiori Design Language.
See moreDeclaration
Swift
public struct FioriColorPalette : ColorPalette
-
Use this structure to create and implement your own custom theme. Check out Theme.Key enums to know what can be configured.
See moreDeclaration
Swift
public struct Theme
-
Undocumented
Declaration
Swift
public struct URLNavigation
-
SwiftUI main view. Use this when you want a full screen out-of-the box view that contains:
BannerView
hidden by default that slides down to display any errors.ChatView
InputBarView
This view will apply the accent color defined in your theme.
Safe Area is ignored at the bottom so the InputBarView can extend and apply the background Blur Effect all the way.
To function properly, this view requires 2 @EnvironmentObject objects to be set:
- viewModel: MessagingViewModel
- themeManager: ThemeManager. Recommended to use
ThemeManager.shared
Usage example:
AssistantView() .navigationBarTitle(Text("Chat"), displayMode: .inline) // if you are in navigation controller .environmentObject( MessagingViewModel(publisher: CAIConversation(config: CAIServiceConfig(SAPURLSession(), <#backendURL#>), channel: "<#channelId#>", token: "<#channelToken#>") ) .environmentObject(themeManager)
Declaration
Swift
public struct AssistantView : View
-
Renders a ScrollView with the list of messages provided by the
See moreMessagingViewModel
Declaration
Swift
public struct ChatView : View
-
Slide down and up a banner view. There is no default background color.
Example of usage:
See moreBannerView("Text to display") .onTapGesture { someError = nil } }
Declaration
Swift
public struct BannerView : View
-
SearchBar SwiftUI wrapper for rendering a TextField, magnifer icon and clear button while editing
See moreDeclaration
Swift
public struct SearchBar<S> : View where S : StringProtocol
-
A view drawing an animated 3 dots. Use
See moreTypingIndicatorData
to customize it. The view comes with a default frame already set.Declaration
Swift
public struct TypingIndicatorView : View
-
InputBar view. Wraps a
TextView
and Send button. Send will callMessagingViewModel.postMessage(text: String)
Height of the TextView grows as user types longer text.Declaration
Swift
public struct InputBarView : View
-
Type-erased container to be used when setting own QuickReply button style If you wish to create your own QuickReply button style, do so by conforming to
ButtonStyle
, put it intoQuickReplyButtonStyleContainer
and useTheme.Key
enumquickReplyButtonStyle()
to apply it.## Example: define style
public struct MyCustomQuickReplyButtonStyle: ButtonStyle { public func makeBody(configuration: MyCustomQuickReplyButtonStyle.Configuration) -> AnyView { return AnyView( configuration.label .font(.body) .lineLimit(1) .padding(EdgeInsets(top: 10, leading: 16, bottom: 10, trailing: 16)) ) } }
Example: apply style
See moreTheme(name: "myCustomTheme", values: [ .quickReplyButtonStyle: QuickReplyButtonStyleContainer(MyCustomQuickReplyButtonStyle()) ])
Declaration
Swift
public struct QuickReplyButtonStyleContainer : ButtonStyle
-
QuickReply button style applied when using custom theme and no specific button style was provided
See moreDeclaration
Swift
public struct BaseQuickReplyButtonStyle : ButtonStyle
-
QuickReply button style applied when using Fiori theme
See moreDeclaration
Swift
public struct FioriQuickReplyButtonStyle : ButtonStyle
-
QuickReply button style applied when using Casual theme
See moreDeclaration
Swift
public struct CasualQuickReplyButtonStyle : ButtonStyle