How To Change Resize Image In SwiftUI

In SwiftUI Image view takes minimal space needed to display an image.

When you create an Image using system icons you’ll get some small image.

Image(systemName: “star”)

To change its size you can scale it with scaleEffect view modifier.

Image(systemName: “star”)
    .
scaleEffect(2)

Or with CGSize to scale it ignoring aspect ratio and stretch it unevenly. If you need to change the aspect ratio read it.

.scaleEffect(CGSize(width: 3, height: 2))

If you want to set a specific size you need to use a resizable view modifier and then frame. The first view modifier makes it as big as possible and the second shrinks it.

Image(systemName: “star”)
    .
resizable()
    .
frame(width: 50, height: 50)