iOS · SwiftUI · SDK 0.0.24
FAQs
Give app users answers inside your app, with an optional email link for further help.
Complete the iOS quickstart first. These examples assume Mobile Joe is configured and MobileJoeUI is added to your app target.
Publish answers
- Select your app in the dashboard and open FAQs.
- Create a FAQ, enter the question and answer, and save it.
- Choose Publish → Publish now. Only live FAQs reach the SDK; drafts and archived answers stay out of the list.
- Arrange the FAQs in the dashboard and add translations if needed. The SDK receives them in dashboard order, using the requested language when a matching translation exists and the original text otherwise.
Add navigation
Use this as your starter ContentView, or add its navigation link to an existing NavigationStack:
import SwiftUI
import MobileJoeUI
struct ContentView: View {
var body: some View {
NavigationStack {
List {
NavigationLink("FAQs") {
FAQView(
presentationMode: .inNavigationStack,
configuration: .standard(recipient: "")
)
}
}
.navigationTitle("Help")
}
}
}
.inNavigationStack uses your app's surrounding navigation stack. FAQView loads the questions automatically; tapping one presents its answer in a sheet.
Present a sheet
For a help button elsewhere in your app, use .asSheet. It supplies a navigation stack and close button:
import SwiftUI
import MobileJoeUI
struct HelpButton: View {
@State private var showingFAQs = false
var body: some View {
Button("Help") { showingFAQs = true }
.sheet(isPresented: $showingFAQs) {
FAQView(
presentationMode: .asSheet,
configuration: .standard(recipient: "support@example.com")
)
}
}
}
Offer email support
A nonempty recipient adds a support hint and email link below each answer. Replace support@example.com with your address, or use .standard(recipient: "") to hide both. The link opens the user's email app.
For your own localized wording, use FAQView.Configuration(recipient:subject:body:contactSupportMailToLabel:contactSupportHint:). The subject and body are optional; the label and hint accept LocalizedStringResource values.
Loading and custom UI
The standard view loads on appearance and supports pull to refresh. Every load requests current answers; there is no FAQ refresh interval or need for debug mode. Loading, empty-list, and failure states are included.
For your own interface, import MobileJoe, keep an observable FAQs() model in @State, and call try await faqs.load() on the main actor after configuration. Read the returned FAQItem values from faqs.all; each exposes id, title, and body. Handle loading errors in your interface. You can also pass your model to FAQView(faqs:presentationMode:configuration:).
Verify
Open a published question and check its answer. Edit the answer in the dashboard, return to the FAQ list, pull to refresh, and reopen it. Test the support link on a device with email configured. If no questions appear, check publication status and that your SDK key belongs to the same dashboard app.