imageScale
Scales images within the view according to one of the relative sizes available including small, medium, and large images sizes.
Declaration
compose().imageScale(scale: SwiftUI.ImageScale)nonisolated func imageScale(_ scale: Image.Scale) -> some ViewParameters
scale*SwiftUI.ImageScaleOne 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")
}
}See also
More in Appearance.
- backgroundSets the view's background to a style.
- badgeGenerates a badge for the view from a localized string resource.
- badgeProminenceSpecifies the prominence of badges created by this view.
- borderAdds a border to this view with the specified style and width.
- buttonSizingThe preferred sizing behavior of buttons in the view hierarchy.
- containerBackgroundSets the container background of the enclosing container using a view.
- headerProminenceSets the header prominence for this view.
- hiddenHides this view unconditionally.
- labelIconToTitleSpacingSet the spacing between the icon and title in labels.
- labelReservedIconWidthSet the width reserved for icons in labels.
- labelsHiddenHides the labels of any controls contained within this view.
- labelsVisibilityControls the visibility of labels of any controls contained within this view.