Reading time: 2 min

This recipe shows how to track SwiftUI animation progress and completion via callbacks. For an animated value (offset, opacity, etc.), get its current value as the animation progresses and then get notified when the animation is completed.

Continue Reading...

Reading time: 2 min

This recipe shows how to present a custom view modally from anywhere in the SwiftUI app. Normally, presenting a view on top of another one forces you do define the transition in the parent view. This solution, however, makes it so that the segue is defined in just a single place and is always presented on top of current view.

Continue Reading...

Reading time: 1 min

This recipe shows how to detect layout direction in your SwiftUI views, which is useful to be able to support both left-to-right (LTR) and right-to-left (RTL) languages. It also shows how to force this setting for testing purposes.

Continue Reading...

Reading time: 2 min

This recipe shows how to show an alert dialog from anywhere in the SwiftUI app. Normally, alert is tied to a specific view, and its content is handled by that view's state. This solution, however, makes it so that the alert is defined in just a single place and is always presented on top of current view.

Continue Reading...

04 Feb 2022

SwiftUI Toast

swiftui

Reading time: 2 min

This recipe shows how to implement an Android-like "toast" notification in SwiftUI.

Continue Reading...