Reading time: 4 min

This recipe shows how to zoom an image in SwiftUI using the pinch/magnify gesture. The image is zoomed in or out at the midpoint between the fingers, supports dragging and double tap to zoom in or reset. The end result looks like this:

preview

The recipe goes as follows:

  1. Use a custom UIVIew wi...

Continue Reading...

Reading time: 6 min

This recipe shows how to play a YouTube video in SwiftUI. The end result looks like this:

Preview iOS

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

This recipe shows only a part of the YouTubePlayer component's functionality, namely that to load a video, play and pause it. Thi...

Continue Reading...

Reading time: 1 min

This recipe shows how to style the progress indicator while using the refreshable on SwiftUI List. The end result looks like this:

preview

This recipe works with the refreshable modifier, which is only available in SwiftUI 3 (iOS 15, macOS 12). If you're interested in custom refresh indicators...

Continue Reading...

Reading time: 1 min

This recipe shows how to set visibility of a SwiftUI view. You can show it, hide it, or remove it from the view hierarchy entirely. The end result looks like this:

preview

We'll adopt a good practice from Android and model the view visibility like this:

enum ViewVisibility: CaseIterable {
  case v...

Continue Reading...

Reading time: 3 min

This recipe shows how to play videos in SwiftUI. It also shows how to add more advanced functionality, such as playing a sequence of videos, adding loop playback and custom end actions. The end result looks like this:

preview

If you wish to know more about what happens in that video, visit th...

Continue Reading...