Shows a brief message about an action the person just took.
Installation
Requires the design system foundation (tokens and theme).
Usage
Apple has no toast API, so .flxToast follows the shape of .alert and .sheet: a binding shows it, and the toast sets it back to false when it goes away.
Use a toast for feedback about something the person just did. Errors and anything they must read belong in an alert.
Icon and message
systemImage adds an SF Symbol in the tint color, and message adds a line under the title.
Actions
Add actions with a trailing closure. A toast with actions doesn't time out: it stays until the person taps an action or the close button that FLX adds next to them. Every action closes the toast, like an alert's buttons.
Don't give an action its own .buttonStyle(_:). The toast closes through its own button style, and the innermost style wins, so that button would stop closing the toast.
Item
Use isPresented: for one toast on the screen, and item: for several. The toast reads its title from an Identifiable value. A value with a new id replaces the toast; the same id with new data updates it in place without restarting its timer.
systemImage, edge, and duration apply to the whole modifier. When different values need a different icon, give each its own .flxToast.
Duration
A toast without actions closes after 4 seconds. Give longer text more time with duration:, so people can finish reading it.
The timer pauses while VoiceOver is on, while the pointer hovers over the toast, while it's being dragged, and while the app is in the background.
Edge
Toasts come in from the top. Use edge: .bottom when the top of the screen holds what the person is working on.
Placement
Attach toasts to the root container, such as a NavigationStack or TabView. Attached to the content inside it, the toast sits below the navigation bar.
Only one toast shows at a time. The outermost .flxToast owns the spot, and every toast inside it, including those on pushed screens, goes there: the newest replaces the one on screen, whose binding goes back to false or nil. No setup is needed.
A sheet is presented apart from the screen behind it, so a sheet that shows toasts needs its own .flxToast on its root view:
Text and translation
The title is a LocalizedStringResource, so a literal is translated and extracted to your String Catalog. Pass a String variable to show it as is, such as a file name.
The message is always a LocalizedStringResource. Put runtime values in through interpolation, which keeps the rest of the sentence translated:
For a message that comes entirely from runtime, interpolate it on its own: message: "\(detail)". Passing a String directly doesn't compile, which keeps literals from silently losing their translation.
Haptics
The toast plays no sound or haptic. Add one with .sensoryFeedback(_:trigger:) (iOS 17 and later) on the same view:
Accessibility
- VoiceOver announces the title and message when the toast appears (iOS 17 and later), and the toast never times out while VoiceOver is on.
- Swiping toward the edge isn't the only way to close: a toast with actions has a close button, and VoiceOver's escape gesture closes any toast.
- With Reduce Motion on, the toast fades instead of sliding.
Before iOS 26, the close button's label is Close, translated only when your String Catalog (Localizable.xcstrings) has that key. From iOS 26, the system close button brings its own translation.
Custom styling
FLXToastStyle is an FLX protocol. Override it for a subtree via .flxToastStyle(_:). The surface uses Liquid Glass on iOS 26 and later and the regular material before it; a custom style draws its own.
configuration.actions already includes the close button and closes the toast when tapped, so the style only places it. It is nil for a toast without actions.
API Reference
flxToast(_:isPresented:)
Both also take a StringProtocol title, shown as is.
flxToast(item:)
The title closure can also return a StringProtocol value.



















