---
updatedAt: 2025-12-09T16:26:14.000Z
agentTools:
  projectIndex: https://developers.openweb.com/llms.txt
---

# iOS SDK: Conversation View

```swift Use completion block
var manager: OWManagerProtocol = OpenWeb.manager

let views: OWUIViews = manager.ui.views

let conversationSettings: OWConversationSettingsProtocol = OWConversationSettings(
style: .compact)

let additionalSettings: OWAdditionalSettingsProtocol = OWAdditionalSettings(fullConversationSettings: conversationSettings)

let conversationViewClosure: OWViewCompletion = { [weak self] result in
    guard let self = self else { return } // Self for example will be the UIViewController
    
    switch result {
      case .success(let conversationView):
        // Add the view to your UI, for example with Snapkit
        self.view.addSubview(conversationView)
        conversationView.snp.makeConstraints { make in
          make.leading.trailing.bottom.equalToSuperview()
          make.top.equalTo(self.myOwnViewAbove.snp.bottom)
        }
      case .failure(let error):
        // Handle the error / Show appropriate user UI
        break
    }
}

let actionsCallbacks: OWViewActionsCallbacks = { callbackType, sourceType, postId in
    // Here sourceType will always be .conversation
    switch callbackType {
      case .writeCommentPressed:
        // Proceed to show comment creation or a screen / your own flow you want the user to see first.
      case .default:
        break
    }
}

views.conversation(
  postId: "somePostId", 
  article: article,
  additionalSettings: additionalSettings,
  callbacks: actionsCallbacks,
  completion: conversationViewClosure
)
```

```swift Use a builder()
var manager: OWManagerProtocol = OpenWeb.manager

let views: OWUIViews = manager.ui.views

let conversationSettings: OWConversationSettingsProtocol = OWConversationSettingsBuilder()
  .style(.compact)
  .build()

let additionalSettings: OWAdditionalSettingsProtocol = OWAdditionalSettings(fullConversationSettings: conversationSettings)

let conversationViewClosure: OWViewCompletion = { [weak self] result in
    guard let self = self else { return } // Self for example will be the UIViewController
    
    switch result {
      case .success(let conversationView):
        // Add the view to your UI, for example with Snapkit
        self.view.addSubview(conversationView)
        conversationView.snp.makeConstraints { make in
          make.leading.trailing.bottom.equalToSuperview()
          make.top.equalTo(self.myOwnViewAbove.snp.bottom)
        }
      case .failure(let error):
        // Handle the error / Show appropriate user UI
        break
    }
}

let actionsCallbacks: OWViewActionsCallbacks = { callbackType, sourceType, postId in
    // Here sourceType will always be .conversation
    switch callbackType {
      case .writeCommentPressed:
        // Proceed to show comment creation or a screen / your own flow you want the user to see first.
      case .default:
        break
    }
}

views.conversation(
  postId: "somePostId", 
  article: article,
  additionalSettings: additionalSettings,
  callbacks: actionsCallbacks,
  completion: conversationViewClosure
)
```

# Define the Conversation settings.

<!-- swift@5-6 -->
<!-- swift@5-7 -->



# Wrap the conversationSettings into an OWAdditionalSettings object that satisfies the OWAdditionalSettingsProtocol contract.

<!-- swift@8 -->
<!-- swift@9 -->

This allows the `conversationSettings` to be used in a context where `OWAdditionalSettingsProtocol` is required.

# Create a closure to capture the response.

<!-- swift@10-25 -->
<!-- swift@11-26 -->

This closure handles the completion of the Conversation view, success scenarios, and failure scenarios.

# Define the behavior after a user action.

<!-- swift@27-35 -->
<!-- swift@28-36 -->

This callback enables you to define which view to display to the user after the Show More Comments button has been pressed.

# Start the Conversation view.

<!-- swift@37-43 -->
<!-- swift@38-44 -->

The `views.conversation()` requires a post ID, an article, the presentational mode, additional settings, and a completion handler.

For more information, refer to the <a href="https://developers.openweb.com/docs/ios-flows-and-views#conversation" target="_blank"><code>conversation()</code></a> reference.