Native customer support chat for your iOS app.
Let customers contact your team from a SwiftUI screen or sheet. Keep your app’s identity, reply in Macaron and carry a reproducible iOS problem into a report your team can investigate.
Add your iOS app freeBy Macaron · Updated
1. Create your iOS workspace and enable chat
In Macaron, choose Apps → Add app → App → iOS. Enter the product name, review and create it. Open Set up chat, enable customer chat and choose SwiftUI. Copy the public app ID shown in setup.
Have your existing Xcode project and an iOS 17+ target ready. Use a deployed HTTPS Macaron server reachable from the test device. Basic text chat does not need a model key, repository or payment connection; APNs is separate from this first message test.
2. Add the source and present a support sheet
Create an iOS app in Macaron, enable customer chat and download MacaronSupportView.swift from Set up chat. Add the source file to your iOS 17+ target in Xcode. The component uses SwiftUI and URLSession; it is not a WebView, an iMessage connection or a published Swift package.
This starter presents chat from your own Help button. Replace YOUR_APP_ID with the public ID from setup. Use macaron.sh for a Macaron-hosted workspace, or your deployed HTTPS server origin for a self-hosted workspace.
import SwiftUI
struct HelpScreen: View {
@State private var showingSupport = false
var body: some View {
Button("Contact support") {
showingSupport = true
}
.sheet(isPresented: $showingSupport) {
MacaronSupportView(
baseURL: URL(string: "https://macaron.sh")!,
appID: "YOUR_APP_ID",
context: "Help screen"
)
}
}
}Restore the right conversation after relaunch
The short example does not persist a session after the view is recreated. For continued access, save the MacaronChatSession from onSession in Keychain and restore it through initialSession. Treat its token as a conversation credential. Keep it out of analytics, bug reports and logs, and separate saved sessions for each product and signed-in customer.
Finish restoring the saved session before presenting chat. Otherwise a customer can start a new conversation while the earlier session is still loading. Give your host app a loading or retry state if Keychain access fails, and test whether the intended conversation is restored after dismissal and relaunch.
When the customer or Macaron product changes, remount the view with .id tied to both and supply the matching restored session. Clear or switch the selected session on sign-out. Merely changing a display name does not establish verified identity or permission to change billing; treat the name and context as customer-supplied information.
3. Verify the sheet in your actual app build
Simulator checks help catch layout and transport issues, but do not establish that a physical device or a release build works. Complete a clearly labeled synthetic conversation using the build and network you intend to support.
- Open the Help sheet and send a test message that identifies the build and iOS version without personal data.
- Confirm the message arrives in the correct Macaron product inbox, reply and read it in the native sheet.
- In Set up chat, choose Check delivery. Confirm customer message received, team reply sent and reply loaded for the same conversation.
- Dismiss and reopen the sheet. Relaunch the app if you implemented Keychain restoration and confirm the intended conversation is accessible.
- Exercise the keyboard, Dynamic Type and VoiceOver in your host navigation. Try a failed connection, then retry without losing the draft.
- Test account switching and repeat the message round trip on a physical iPhone before release.
Separate basic chat from optional native features
If chat cannot load, verify the app ID, enabled setting and HTTPS server reachability. A phone cannot access your laptop through its own localhost address. Do not weaken App Transport Security to work around a production server or certificate problem.
Keep the support screen in your own navigation and configure the product’s logo and appearance. Basic chat does not install APNs credentials, collect screenshots or replay a customer session. Push, native review prompts and purchase restoration require separate host-app integrations and their own checks; a successful chat round trip does not verify those capabilities.
For a code problem, ask for the affected screen, actual app build, iOS version, reproduction steps and expected behavior. Create a report from the conversation, review any coding changes and re-test those steps against the build you plan to release. Customer confirmation and code verification remain separate records.