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. The end result looks like this:

preview

The recipe goes as following:

  1. Declare an enum that holds aliases for focusable fields. In the code below, that's Form...

Continue Reading...

Reading time: 1 min

This recipe shows how to add a toolbar with action buttons on the top of soft keyboard in SwiftUI. The end result looks like this:

Simulator%20Screen%20Shot%20-%20iPhone%20SE%20%282nd%20generation%29%20-%202021-08-19%20at%2020.31.05

This feature is available starting with SwiftUI 3 (iOS 15, macOS 12).

The pattern for adding the toolbar to the keyboard is the same as with toolbar setups,...

Continue Reading...

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 w...

Continue Reading...

Reading time: 2 min

This tutorial shows you how to create a search bar in SwiftUI. There are two ways of doing it:

  1. Create a custom view, which works on any SwiftUI Version.
  2. Use the searchable modifier, introduced in Swift 3.

Custom Search Bar View

The end result will look something like this:

Search bar in SwitUI

The s...

Continue Reading...

Reading time: 1 min

This recipe shows how to add an image picker to your SwiftUI app. You'll do this by wrapping a UIKit UIImagePickerController in a UIViewControllerRepresentable. The end result looks like this:

Preview

This recipe is a part of our Road to DigitalSignatureView series, which explores various co...

Continue Reading...