The Image
component in the Scripting app allows you to display images from various sources, such as system symbols, network URLs, local files, or UIImage
objects. Additionally, several view modifiers are available to customize the behavior and appearance of the Image
component.
ImageResizable
Defines how the image should be resized:
boolean
:
true
: Enables default resizing.false
: Disables resizing.object
:
capInsets
(optional): EdgeInsets
resizingMode
(optional): ImageResizingMode
ImageScale
Specifies relative image sizes available within the view:
'large'
: Renders the image at a large size.'medium'
: Renders the image at a medium size.'small'
: Renders the image at a small size.SystemImageProps
systemName
(string, required)
The name of a system-provided symbol.
Refer to the SF Symbols library or use the SF Symbols Browser app to browse available symbol names.
variableValue
(number, optional)
A value between 0.0
and 1.0
for customizing the appearance of a variable symbol.
(Has no effect for symbols that do not support variable values.)
resizable
(ImageResizable, optional)
Configures how the image is resized to fit its allocated space.
NetworkImageProps
imageUrl
(string, required)
The URL of the image to load.
placeholder
(VirtualNode, optional)
A view displayed while the image is loading.
resizable
(ImageResizable, optional)
Configures how the image is resized to fit its allocated space.
FileImageProps
filePath
(string, required)
The path to the local image file.
resizable
(ImageResizable, optional)
Configures how the image is resized to fit its allocated space.
UIImageProps
image
(UIImage, required)
A UIImage
object to display.
resizable
(ImageResizable, optional)
Configures how the image is resized to fit its allocated space.
CommonViewProps
Modifiers applicable to the Image
component and other views:
scaleToFit
(boolean, optional)
Scales the view to fit its parent container.
scaleToFill
(boolean, optional)
Scales the view to fill its parent container.
aspectRatio
(object, optional)
Configures the view's aspect ratio:
value
(number or null, optional): The width-to-height ratio. If null
, maintains the current aspect ratio.contentMode
(ContentMode, required): Determines whether the content fits or fills its parent.imageScale
(ImageScale, optional)
Adjusts the size of images within the view. Options: 'large'
, 'medium'
, 'small'
.
foregroundStyle
(ShapeStyle or DynamicShapeStyle or object, optional)
Configures the view's foreground elements:
primary
: Style for the primary foreground elements.secondary
: Style for secondary elements.tertiary
(optional): Style for tertiary elements.Image
is a functional component that renders an image based on the provided source and supports the aforementioned modifiers.
systemName
.imageUrl
.filePath
.UIImage
Objects: Rendered directly using a UIImage
instance.UIImage
Object with Scale and Aspect RatioscaleToFit
, scaleToFill
, and aspectRatio
to achieve precise layout configurations.foregroundStyle
property for detailed styling of elements like icons or shapes within the Image
view.systemName
against the SF Symbols library to ensure availability.