Pattern · Settings
NewHelp and Support SwiftUI Block
The Help section of Settings: search that filters answers as you type, questions that open in place, chat, email, call and a problem report.
Where people look for an answer before they ask. A search field filters your articles live and the top questions open in place, then Contact us offers chat with its availability, email, a call with your hours and Report a problem. The report sheet sends a category, a description and optional diagnostics, and the version line copies with a tap.
- SwiftUI
- iOS 17.0+
- help-support
$199 once, every piece included. See how installing works · Sign in
01
What's included
SwiftUI source you own, built on Apple frameworks only.
- Live search across questions, answers and keywords, with a count and an empty state
- Questions that open in place with a link to the full article
- Chat with an Online or Away chip, Email and Call with your hours
- A report sheet with a category, description, diagnostics and Send states
- A version line that copies with a tap
02
Implementation notes
How it behaves, what it handles, and the decisions behind it.
A search field sits on top. As the person types, Top questions becomes Results with a count beside it, matching every word against the questions, answers and the keywords you give; when nothing matches it says "No articles match" with the words and suggests contacting you. A clear button empties the field. Each question opens in place: the chevron turns, the answer appears under it and, when the article has a URL, a "Read the full article" link opens it. Contact us lists Chat with us with an Online or Away chip and your reply time or return time, Email with your address, which opens Mail, Call with the number and hours, and Report a problem. That opens a sheet with a category (Bug, Account, Billing, Other), a description, Include diagnostics and Send, which shows a spinner, then a checkmark and closes the sheet; a thrown error stays in the sheet under the button. The version and build close the block; tapping them copies them and shows "Copied" for a moment. Pass nil for the articles while they load and the questions card shows grey shapes.
Notes
HelpSupport(articles:contact:version:onChat:onReport:). Onlyarticlesis required; every other part appears when you pass it. It is a section: no navigation stack, background, padding or scroll view of its own, so place it in your own column, such as aScrollViewwith.padding(.horizontal, 20)and.scrollDismissesKeyboard(.interactively). The report form is a sheet the block presents.articlesis a list ofHelpSupport.Article, most asked first: anid, thequestion, a shortanswer, an optionalurlto the full article andkeywordsthe search should also match ("backup", "refund"). An empty list hides the search and the questions.Article.samplesis the four questions from the preview.contactis aHelpSupport.Contact:chatas anAvailability(.online(reply:)or.away(back:), each with an optional line such as "Replies in a few minutes"), anemail, aphoneand itshours. Each part left out hides its row, and the card goes when there is nothing to show. Chat with us also needsonChat, which opens your chat screen.- Email and Call open
mailto:andtel:URLs with the environment'sopenURL. Leavephoneout on devices that can't call. onReportreceives aHelpSupport.Report: itscategory, the trimmedmessageand, when Include diagnostics is on (the default),Diagnosticswith the app version, iOS version and device model. It isasync throws. Send is enabled once the description has text. Throw to keep the sheet open with aLocalizedError'serrorDescription, or "Your report didn't send. Try again." ACancellationErrorgoes back to rest quietly. The sheet can't be swiped away while a report sends. Nil hides Report a problem.versiondefaults toHelpSupport.appVersion, the main bundle's short version and build ("2.4 (318)"). Pass your own string, or nil to hide the line.- Haptics: a selection tick on the report category, success when the version copies or a report sends and an error when one fails.
- VoiceOver reads each question with Expanded or Collapsed and a hint, the answer as text, Read the full article as a link, Chat with us with its availability, and the version with "Copies the version". It announces "Version copied", "Report sent" and failures. Every target is at least 44 points tall. At accessibility sizes the rows wrap their notes and the report categories stack.
- Reduce Motion turns the answers, the search results and the sheet's states into short fades.
HelpSupportExampleat the end ofHelpSupport.swiftis the Help page from the preview: the sample questions, chat online, email, a phone line with its hours, version 2.4 (318) and a report that takes a moment and sends. PasswrapsInNavigationStack: falseto push it in your own stack. The States preview shows the loading layout with chat away, and a block with only email.
Theming
- Reads
SPThemefrom@Environment(\.spTheme)and requires thedesign-systemitem. - The search field is 52 points on
fillwithradius.mdand a 1 pointseparatorhairline that turns totextPrimarywhile focused; its prompt istype.body, the glasstextSecondaryand the clear buttontextTertiary. - Cards are
color.surfacewithradius.lg; rows are 16 points in from the edge (space.lg) withSPHairlinedividers inseparator. Groups sit 24 points apart (space.xl) undertype.headlinetitles, with the result count intype.footnoteandtextSecondary. - Questions and row titles are
type.bodyintextPrimary; answerstype.subheadintextSecondary; Read the full articletype.subheadsemibold intextPrimary; notestype.footnoteintextSecondary; symbolstextSecondary; chevrons and arrowstextTertiary. - The Online chip is
successon a 14% tint with asuccessdot; Away istextSecondaryonfillwith atextTertiarydot. - The report sheet sits on
color.bgwith atype.title3title. Categories are capsules, the chosen onetextPrimarywithsurfacetext, the othersfill. The description field matches the search field. Send isaccentwithaccentOntext intype.headlineandradius.md, the block's primary action; the diagnostics switch takes the accent tint. Errors aretype.footnoteindanger. - The version line is
type.captionwith monospaced digits intextTertiary, and "Copied" intextSecondary. - Answers and results move with
motion.smooth, small changes withmotion.snappy; both become short fades under Reduce Motion.
03
Keep building
Pieces that work well next to this one.