SwiftUI Image View: Deep Dive

Use an Image instance when you want to add images to your SwiftUI app. You can create images from many sources:
  • Image files in your app’s asset library or bundle. Supported types include PNG, JPEG, HEIC, and more.
  • Instances of platform-specific image types, like UIImage and NSImage.
  • A bitmap stored in a Core Graphics CGImage instance.
  • System graphics from the SF Symbols set.

In this section, we will take a closer look at SwiftUi's ImageView.

The Basics

Start with basics of SwiftUI ImageView.

Aspect Ratio

SwiftUI ImageView and AspectRatio for images

ScaledToFit

Scaled to fit ImageView modifier for SwiftUI

ScaledToFill

SwiftUI ImageView's ScaledToFill modifier

Clipped

ImageView's clipped modifier in SwiftUI's ImageView

ClipShape

ClipShape modifier in SwiftUI's ImageView

CGImage

Render CGImage with ImageView

Image Interpolation

Image interpolation in ImageView

RenderingMode

Image rendering mode for ImageView in SwiftUI

ScaledMetric

ScaledMetric PropertyWrapper with Image view

Working with SFSymbol

SF Symbols in ImageView

SymbolVariant

SymbolVariant for SF Symbol in SwiftUI ImageView

ForegroundStyle

SF Symbol Foreground Style

Dynamic Scaling in SF Symbol

Dynamic fonts and SF Symbols in ImageView