Reading time: 11 min
Here you can find recipes for common tasks you need when working with the new Swift 5.5 concurrency model.
Where applicable, there's before and after comparison that shows how things where done before async/await (mostly with GCD) and how they can be done now.
Navigate Fields Using Keyboard in SwiftUI
Reading time: 1 min
This recipe shows how to navigate from one text field to another using keyboard buttons in SwiftUI by combining @FocusState
and onSubmit
.
Keyboard Toolbar in SwiftUI
Reading time: 1 min
This recipe shows how to add a toolbar with action buttons on the top of soft keyboard in SwiftUI.
Reading time: 6 min
Pull to refresh is a common UI pattern, supported in UIKit
via UIRefreshControl
. (Un)surprisingly, it's also unavailable in SwiftUI. (EDIT: It's been added in SwiftUI 3 - however, it has many drawbacks compared to this solution.)
This recipe shows how to implement this functionality with any ScrollView
. It also doesn't rely on UIViewRepresentable
.
Search bar in SwiftUI (Updated 08/21)
Reading time: 2 min
This tutorial shows you how to create a search bar in SwiftUI. There are two ways of doing it:
- Create a custom view, which works on any SwiftUI Version.
- Use the
searchable
modifier, introduced in Swift 3.