Reading time: 2 min
This recipe shows how to show multiple Alert
s, ActionSheet
s or custom dialogs, without tying them to multiple views. The end result looks like this:
The usual way of using multiple views has its shortcomings, as it:
- Forces you to have at least as many views as distinct modals you wish...
Progress Dialog / HUD in SwiftUI
Reading time: 1 min
This recipe shows how to render a progress dialog / HUD in SwiftUI. The end result looks like this:
This component is available as a Swift Package in this repo.
In order to make this happen, we'll use the custom view dialog from this recipe. If you haven't yet, be sure to check it ou...
Custom View Dialog in SwiftUI
Reading time: 1 min
This recipe show how to display a custom dialog in SwiftUI. You can customize the dialog content in any way you want.
Here's what the end result can look like:
This component is available as a Swift Package in this repo.
The custom dialog will be a ViewModifier
that wraps the attac...
SwiftUI Alert with TextField
Reading time: 2 min
This recipe shows how to add a TextField
to a SwiftUI alert
dialog. The end result looks like this:
The dialog supports:
- Custom title and message.
- Text field with a placeholder and keyboard type.
- Confirm button, whose callback returns the content of the text field.
- Optiona...