Image

public struct Image : View
extension Image: Renderable

A view that renders an image.

  • Declaration

    Swift

    public enum ResizingMode
  • Declaration

    Swift

    public var viewStore: ViewValues
  • Declaration

    Swift

    public var body: View { get }
  • Initializes an Image with a UIImage.

    Declaration

    Swift

    public init(uiImage image: UIImage)
  • Initializes an Image by looking up a image asset by name. Optionally specify a bundle to search in, if not, the app’s main bundle will be used.

    Declaration

    Swift

    public init(_ name: String, bundle: Bundle? = nil)
  • Specify if the image should dynamically stretch its contents.

    When resizable, the image will expand both horizontally and vertically infinitely as much as its parent allows it to. Also, when specifying a frame, the image contents will stretch to the dimensions of the specified frame.

    Note

    Use .scaledToFit() and .scaledToFill() to modify how the aspect ratio of the image varies when stretching.

    Declaration

    Swift

    public func resizable(capInsets: EdgeInsets = EdgeInsets(), resizingMode: Image.ResizingMode = .stretch) -> Image

    Parameters

    capInsets

    The values to use for the cap insets.

    resizingMode

    The mode with which the interior of the image is resized.

  • Sets the rendering mode of the image.

    Declaration

    Swift

    public func renderingMode(_ renderingMode: Image.TemplateRenderingMode?) -> Image
  • Declaration

    Swift

    public enum TemplateRenderingMode
  • Declaration

    Swift

    public func createView(context: Context) -> UIView
  • Declaration

    Swift

    public func updateView(_ view: UIView, context: Context)