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

Reading time: 3 min

This recipe shows how to customize a Progress view by implementing a custom ProgressViewStyle. You'll implement a circular progress bar that supports both definite and indefinite progress. The end result will look like this:

Preview

Progress view and ProgressViewStyle were introduced in SwiftU...

Continue Reading...

Reading time: 1 min

Here's a simple recipe to help you draw Arc shapes in SwiftUI. For some reason, arcs still aren't a part of the standard Shape package, but fortunately, wrapping them isn't too difficult. The end result looks like this:

Screenshot%202021-08-11%20at%2012.48.33

As you can see, the arcs can be stroked and filled just like any other S...

Continue Reading...