# cloud-sdk-ios-cai **Repository Path**: mirrors_SAP/cloud-sdk-ios-cai ## Basic Information - **Project Name**: cloud-sdk-ios-cai - **Description**: Swift package as module for interfacing with SAP Conversational AI in native iOS apps. - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-05-11 - **Last Updated**: 2026-05-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
SAP Conversational AI SDK for iOS
## Dependencies
- [SAPCommon](https://help.sap.com/doc/978e4f6c968c4cc5a30f9d324aa4b1d7/Latest/en-US/Documents/Frameworks/SAPCommon/index.html) for Logging
- [SAPFoundation](https://help.sap.com/doc/978e4f6c968c4cc5a30f9d324aa4b1d7/Latest/en-US/Documents/Frameworks/SAPFoundation/index.html) for Network Connectivity and Authentication
- [SDWebImage](https://github.com/SDWebImage/SDWebImage) for asynchronous image loading and gif animation in SwiftUI
- [Down](https://github.com/johnxnguyen/Down) for Markdown / CommonMark rendering in Swift
## Installation
The package is intended for consumption via Swift Package Manager. To add `SAPCAI` to your application target, navigate to the File > Add Packages... >. Use the Search or Enter Package URL field to find the package using the repository URL https://github.com/SAP/cloud-sdk-ios-cai.
You can choose one of the following package products to be added to your application/framework target.
|Package Product|When to Use
|---|---|
|SAPCAI|You did not already embed binary frameworks from SAP BTP SDK for iOS|
|SAPCAI-requiresToEmbedXCFrameworks|You already embedded `SAPCommon` and `SAPFoundation` binary frameworks to your target|
## Getting Started
The code snippet below illustrates setting up the `CAIConversation` Combine publisher to initialize the `MessagingViewModel` for the `AssistantView`. For prototyping you can connect the iOS client directly with SAP Conversational AI *Community Edition*. You have to replace variable values in angle brackets (e.g. `
Each theme will come with a color palette that supports both light and dark modes.
### Fiori Theme
```swift
ThemeManager.shared.setCurrentTheme( .fiori(FioriColorPalette()) )
```
### Casual Theme
**No longer maintained and therefore marked as deprecated. Do not use!**
```swift
ThemeManager.shared.setCurrentTheme( .casual(CasualColorPalette()) )
```
### Create Your Own Custom Theme
You can also provide an alternative color palette or provide a custom theme.
## Persistent Static Menu
In SAP Conversational AI you can add persistent static menu options to your chatbot enabling your users to quickly trigger links or skills at any point during the conversation.
Use `CAIChannelService.loadPreferences` to fetch your channel's preferences (incl. the persistent static menu) asynchronously, then set `MessagingViewModel.menu`.
```Swift
service.loadPreferences(channel: channel) { result in
DispatchQueue.main.async {
switch result {
case .success(let data):
viewModel.menu = data?.menu
case .failure:
break
}
}
}
```

## Limitations
### Markdown Related
- **No support for [GitHub Flavored Markdown](https://github.github.com/gfm/)** (e.g. ~~strikethrough~~). Bot responses containing [Markdown](https://help.sap.com/viewer/a4522a393d2b4643812b7caadfe90c18/latest/en-US/3a3b6e09e96249b884dcf6e69eecd830.html#loio3a3b6e09e96249b884dcf6e69eecd830__section_markdown) will be rendered by the `AssistantView` according to the [Commonmark specification](https://spec.commonmark.org/0.29/) only, and unknown syntax will be treated as text.
### Trigger Skill Button Related
- `Trigger Skill` buttons are still enabled after execution / next interaction. This behavior differs from the SAP CAI Web Client. Once you click the button or type an utterance, the corresponding skill can't be triggered anymore at a later point in time since the context in which it was created might not be valid anymore.
### Image Related
- Not being able to save, copy, or share an image as part of a bot response. Currently, there is no gesture handler attached to an image view which could allow opening a contextual menu offering such features (similar to iMessage or WhatsApp).
## How to Obtain Support
Please [raise an issue on GitHub](https://github.com/SAP/cloud-sdk-ios-cai/issues/new/choose). SAP customers can continue to report issues through OSS for SLA tracking.
Raise questions around CAI in the [SAP CAI Answers](https://answers.sap.com/tags/73555000100800001301) forum.
## Contributing
If you want to contribute, please check the [Contribution Guidelines](./CONTRIBUTING.md).
## Examples
The `CAITestApp` in this repository allows you to
- choose a theme
- view static mock data or
- connect against a live system by either
- letting the user choose the mobile channel from the list of available mobile channels for given Application ID (a.k.a targetSystem); note: this illustrates the use of `CAIChannelService` and how to build a simple SwiftUI view on top of it
- loading the `AssistantView` for a specific mobile channel
See [here](https://github.com/SAP/cloud-sdk-ios-cai/tree/main/CAITestApp) on how to maintain connection settings for the test application.