---
schema_version: "1"
id: 12bb3f7ede5137272ee118cd0b056efa641507d44222186d0b8a9ddf0164f2e6
title: Use Full UI
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/genai/agentforce-mobile-sdk/guides/ios/agentforce-mobile-sdk-ios-prebuilt-ui.md
canonical_url: https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-ios-prebuilt-ui.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 71a05698bdf2ccbbb5a1c7fb4da3cd652f6702677a554dc184fa0b779b5072d0
products:
  - Agentforce Mobile SDK
  - Agentforce and Einstein Generative AI
---
# Use Full UI

This guide shows you how to use the prebuilt UI components to quickly integrate Agentforce chat functionality into your iOS app.

## Chat UI

The Chat UI is the primary chat view for interacting with Agents.

**TODO: <Image of Chat UI>**

To display the chat UI, use the createAgentforceChatView method. This method returns a SwiftUI view that you can present to the user.

```swift
do {
    let chatView = try agentforceClient.createAgentforceChatView(
        conversation: conversation,
        delegate: self,
        onContainerClose: {
            // Handle chat view close
        }
    )
    // Present the chatView in your SwiftUI hierarchy
} catch {
    // Handle error
}
```

The createAgentforceChatView method takes the following parameters:

- `conversation`: The AgentConversation object that you created earlier
- `delegate`: An object that conforms to the AgentforceUIDelegate protocol. This delegate receives notifications about UI events
- `onContainerClose`: A closure that's called when the user closes the chat view

## Handle UI Events

To handle UI events, implement the AgentforceUIDelegate protocol. This protocol has the following methods:

- `modifyUtteranceBeforeSending(_:)`: This method is called before an utterance is sent to the agent. It allows you to modify the utterance before it is sent.
- `didSendUtterance(_:)`: This method is called after an utterance has been sent to the agent.
- `userDidSwitchAgents(newConversation:)`: This method is called when the user switches to a different agent.

```swift
extension YourViewController: AgentforceUIDelegate {
    func modifyUtteranceBeforeSending(_ utterance: AgentforceUtterance) async -> AgentforceUtterance {
        // Modify the utterance if needed
        return utterance
    }

    func didSendUtterance(_ utterance: AgentforceUtterance) {
        // Handle sent utterance
    }

    func userDidSwitchAgents(newConversation: AgentConversation) {
        // Handle agent switch
    }
}
```

<!-- **@TODO: <Discuss other UI Containers/Launchers>**

**[INFORMATION NEEDED: What other UI containers/launchers are available?]**

- Are there different UI presentation modes?
- What launcher options exist?
- How do different UI containers work?
- What customization options are available for the prebuilt UI? -->

## Next Steps

- **Headless**: See [Build a Headless Experience](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-ios-headless.md) for custom UI
- **Customization**: See [Theming](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-ios-branding-theming.md) for visual customization
