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

Reading time: 1 min

This recipe shows two ways of detecting when your app goes to foreground or background.

NotificationCenter solution

The first solution works on iOS 13+ and any device, iPhone or iPad, and is generally the one you should use. First, add these two extensions to your app:

extension View {
  f...

Continue Reading...

Reading time: 4 min

This recipe shows how to render GIFs in SwiftUI. The end result looks like this:

Preview iOS

This component is available as a Swift package in this repo.

GIFs are a weird animal in the iOS/macOS world - while CoreGraphics contain ways of extracting GIF-related info from raw data, there's no na...

Continue Reading...

Reading time: 4 min

This recipe shows how to embed a WKWebView into SwiftUI and have a (somewhat) functional browser in your app! The end result looks like this:

Preview iOS

This component is available as a Swift package in this repo.

Modelling the behaviour

WKWebView is a powerful and intricate component that d...

Continue Reading...