Skip to main content
The recommended way to integrate Molin AI in your iOS app is by rendering our widget inside a WKWebView component. See the full working example on GitHub: molin-ai/molin-ai-ios-example.

Basic setup

Create an HTML file that loads the widget and displays the chat component fullscreen:
Replace YOUR_WIDGET_ID with your actual widget ID from the Molin dashboard. The show-close attribute is optional. It renders a close button (✕) in the chat header, which is useful when the widget is displayed fullscreen in a webview. You can omit it if your app has its own navigation to dismiss the chat.

Handling the close button

When the user taps the close button, the <molin-shop-ai-chat> element fires a molin-shop-ai-chat:close-click event. Navigate to a custom molin:// URL to tell the native side to go back:
On the Swift side, intercept the molin:// scheme in a WKNavigationDelegate: