SwiftUI Image: a closer look

DevTechie
DevTechie
Published in
13 min readNov 16, 2021

There is a famous saying “A picture is worth a thousand words” 😎 so we are gonna learn about Image views in SwiftUI.

We can use Image view to display images inside our app. In its simplest form Image View can be initialized with

Image("image name")

or

Image(systemName: "SF symbol name")

Asset Image

Image(“dt”) initializer can load and display an image that is part of app bundle or inside Assets catalog folder. This initializer takes name of image as the parameter. Assets catalog supports both bitmap and PDF based vectors and Image view is capable of rendering both types without any issue.

struct ImageExample: View {
var body: some View {
Image("dt") // dt is name of image in Assets
}
}

System Image

Image(systemName: “person.circle”) initializer accepts string name for SF symbol.

struct ImageExample: View {
var body: some View {
Image(systemName: "person.circle")
.font(.system(size: 100))
}
}

As you can see in the code above, with SF symbol initializer, you can apply font size.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in