Update SwiftUI Navigation Bar on Scroll
Reading time: 1 min
This recipe shows how to update navigation bar when the content underneath it scrolls.
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.
SwiftUI ScrollView Scroll Offset
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.
SwiftUI Navigation Bar Title Custom View
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.
SwiftUI List Section Index Title
Reading time: 3 min
This recipe shows how to add section index with titles to a SwiftUI List. This will render a vertical list of custom shortcuts on the right-hand side of the list, allowing you to quickly navigate to any section by pressing or just moving your finger over it. The same functionality in UITableView
is implemented with sectionIndexTitles(for:)
and tableView(_:sectionForSectionIndexTitle:at:)
.