Initializer

init(systemName:)

Creates an image object containing a system symbol image.

Declaration

init?(systemName name: String)

Parameters

name

The name of the system symbol image. Use the SF Symbols app to look up the names of system symbol images. You can download this app from the design resources page at developer.apple.com.

Return Value

The object containing the specified symbol image, or nil if no suitable image was found.

Discussion

Use this method only to retrieve system-defined symbol images. To retrieve a custom symbol image stored in your app's asset catalog, use the init(named:) method instead.

This method checks the system caches for an image with the specified name and returns the variant of that image that is best suited for the main screen. If a matching image object is not already in the cache, this method creates the image from the specified system symbol image. The system may purge cached image data at any time to free up memory. Purging occurs only for images that are in the cache but are not currently being used.

See Also

Loading and Caching Images

Providing Images for Different Appearances

Supply image resources that work for light and dark appearances and for high-contrast environments.

Configuring and Displaying Symbol Images in Your UI

Create scalable images that integrate well with your app’s text, and adjust the appearance of those images dynamically.

Creating Custom Symbol Images for Your App

Create symbol images and expand on the icons provided by SF Symbols.

init?(named: String, in: Bundle?, compatibleWith: UITraitCollection?)

Creates an image object using the named image asset that is compatible with the specified trait collection.

init?(named: String, in: Bundle?, with: UIImage.Configuration?)

Creates an image object using the named image asset that is compatible with the specified configuration.

init?(named: String)

Creates an image object from the specified named asset.

init(imageLiteralResourceName: String)

Returns the image object associated with the specified resource.

init?(systemName: String, withConfiguration: UIImage.Configuration?)

Creates an image object containing a system symbol image with the specified configuration.

init?(systemName: String, compatibleWith: UITraitCollection?)

Creates an image object containing a system symbol image appropriate for the specified traits.