ContentMode

public enum ContentMode

The content mode determines the layout of the image when its size does not precisely match the size that the element is assigned.

  • The image is not scaled, and is simply centered within the Image element.

    Declaration

    Swift

    case center
  • The image is stretched to fill the Image element, causing the image to become distorted if its aspect ratio is different than that of the containing element.

    Declaration

    Swift

    case stretch
  • The image is scaled to touch the edges of the Image element while maintaining the image’s aspect ratio. If the aspect ratio of the image is different than that of the element, the image will be letterboxed or pillarboxed as needed to ensure that the entire image is visible within the element.

    Declaration

    Swift

    case aspectFit
  • The image is scaled to fill the entire Image element. If the aspect ratio of the image is different than that of the element, the image will be cropped to match the element’s aspect ratio.

    Declaration

    Swift

    case aspectFill