Creates an image object containing a system symbol image appropriate for the specified traits.
- iOS 13.0+
- Mac Catalyst 13.0+
- tvOS 13.0+
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.
The traits associated with the intended environment for the image. Use this parameter to ensure that the correct variant of the image is loaded. If you specify
nil, this method uses the traits associated with the main screen.
The object containing the image variant that matches the specified trait collection, or
nil if no suitable image was found.
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 specified traits. 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.