Contents

imageScale(_:)

Scales images within the view according to one of the relative sizes available including small, medium, and large images sizes.

Declaration

nonisolated func imageScale(_ scale: Image.Scale) -> some View

Parameters

  • scale:

    One of the relative sizes provided by the image scale enumeration.

Discussion

The example below shows the relative scaling effect. The system renders the image at a relative size based on the available space and configuration options of the image it is scaling.

VStack {
    HStack {
        Image(systemName: "heart.fill")
            .imageScale(.small)
        Text("Small")
    }
    HStack {
        Image(systemName: "heart.fill")
            .imageScale(.medium)
        Text("Medium")
    }

    HStack {
        Image(systemName: "heart.fill")
            .imageScale(.large)
        Text("Large")
    }
}

[Image]

See Also

Configuring an image