API reference

Image Struct

Extends ViewComponentSerializable, FlexShapedComponent, Sendable
An image component displayed on the wearable.
An image can be loaded from a remote URI or supplied as a local UIKit/UIImage. A local image is downscaled to the display bounds and inlined into the payload, so it renders on the glasses without a network fetch.

Signature

struct Image: ViewComponentSerializable, FlexShapedComponent, Sendable

Constructors

init ( uri , sizePreset , cornerRadius )
Creates an image component with the given URI and styling.
Signature
public init( uri: String,  sizePreset: ImageSize,  cornerRadius: CornerRadius)
Parameters
uri: String  The URI of the image to display.
sizePreset: ImageSize  How the image should be sized. Defaults to ImageSize.icon.
cornerRadius: CornerRadius  Corner rounding preset. Defaults to CornerRadius.none.
init ( image , sizePreset , cornerRadius )
Creates an image component from a local image.
The image is downscaled to the display bounds and inlined into the display payload as data, so it renders on the glasses without a network fetch.
Signature
public init( image: UIImage,  sizePreset: ImageSize,  cornerRadius: CornerRadius)
Parameters
image: UIImage  The local image to display.
sizePreset: ImageSize  How the image should be sized. Defaults to ImageSize.fill.
cornerRadius: CornerRadius  Corner rounding preset. Defaults to CornerRadius.none.

Properties

alignSelf : Alignment?
Per-child cross-axis alignment override applied when this image is a child of a FlexBox.
cornerRadius : CornerRadius
Corner rounding preset.
flexGrow : Float
Flex-grow factor applied when this image is a child of a FlexBox.
flexShrink : Float
Flex-shrink factor applied when this image is a child of a FlexBox.
sizePreset : ImageSize
How the image should be sized.
uri : String
The URI of the image to display. Empty for an image created from a local UIKit/UIImage.

Functions

alignSelf ( value )
Overrides the cross-axis alignment applied when this image is a child of a FlexBox.
Signature
public func alignSelf(_ value: Alignment) -> Image
Parameters
_ value: Alignment
Returns
Image
flexGrow ( value )
Sets the flex-grow factor applied when this image is a child of a FlexBox.
Signature
public func flexGrow(_ value: Float) -> Image
Parameters
_ value: Float
Returns
Image
flexShrink ( value )
Sets the flex-shrink factor applied when this image is a child of a FlexBox.
Signature
public func flexShrink(_ value: Float) -> Image
Parameters
_ value: Float
Returns
Image