Reading time: 2 min

This article is a cheatsheet for using system images/icons (SF Symbols) in SwiftUI. It shows all the ways to set their size, color and variants. The end results look like this:

combined

Basics

System images or system icons refer to images that are present by default on Apple platforms. The image co...

Continue Reading...

Reading time: 1 min

This recipe shows how to tint SwiftUI images in two ways - by setting the template tint or color multiply. The end result looks like this:

Screenshot%202022-03-09%20at%2010.03.26

Let's start by saying that foregroundColor has no effect here. With that out of the way, the recipe depends on what you want to do with the image, since...

Continue Reading...

Reading time: 1 min

This quick recipe shows how to display an image from Assets catalog in SwiftUI.

Say that you've added your image to the Assets catalog:

Screenshot%202022-03-08%20at%2020.50.32

All you have to do to render it on the screen is to pass its name to Image:

Image("logo_small")

Screenshot%202022-03-09%20at%2009.53.10

Using Image(decorative:) does the same thing.

Continue Reading...

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: 3 min

This recipe provides a drop-in replacement for iOS 15 AsyncImage. This allows you to load images from remote sources on any SwiftUI version, with the code being exactly the same (minus the Compat at the end of name :]). The end result looks like this:

preview

AsyncImage and AsyncImageCompat bot...

Continue Reading...