Reading time: 6 min

This recipe shows how to add easy-to-use segues to your SwiftUI navigation. They allow for presenting views using common UIKIt Segue types - push, modal and popover. The end result looks like this:

preview

Navigating between views/screens in SwiftUI is more difficult and convoluted than it is in UIK...

Continue Reading...

Reading time: 1 min

This recipe shows how to update navigation bar when the content underneath it scrolls. The end result looks like this:

preview

The recipe relies on the ObservableScrollView from this recipe, because it can track its scroll offset. After that, it becomes trivial to check if the user has scrolled p...

Continue Reading...

Reading time: 1 min

This quick recipe shows how to scroll a SwiftUI ScrollView programatically when the scrolling trigger is not wrapped in a ScrollViewReader. E.g, the image below shows scrolling triggered from navigation bar buttons:

preview

As you know, you can scroll a ScrollView programatically using a Scroll...

Continue Reading...

Reading time: 2 min

This recipe shows how to get current scroll offset of a SwiftUI ScrollView. The necessary functionality is wrapped in a new component, ObservableScrollView, which works exactly the same as ScrollView does, but also exposes its current scroll offset in a binding. The end result looks like thi...

Continue Reading...

Reading time: 1 min

This quick recipe shows how to put any custom view in a navigation bar, replacing the default navigation bar title text. Of course, that view can be interactable and respond to user input. The end result looks like this:

preview

This solution works for SwiftUI 2+ (iOS 14+, macOS 11+).

The tric...

Continue Reading...