Image Modifiers...

.border

.clipped

Image(decorative: "xxx")

Source: HWS,

.frame

// .frame(maxWidth: .infinity, maxHeight: .infinity)
.aspectRatio(1, contentMode: .fit)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.aspectRatio(1, contentMode: .fit)

...

.frame(maxWidth: .infinity) // give as much as space it needs

ImagePaint()

Repeats the image on the given space.

Hacking with Swift / 100 Days / Day-44 - Creative borders and fills using ImagePaint

.resizable()

Stretches the image.

.scaledToFill()

.scaledToFit()

Last updated