Initializer

init(templateImageName:)

Creates a Home screen quick action icon based on an image in your app’s bundle, preferably in an asset catalog.

Declaration

convenience init(templateImageName: String)

Parameters

templateImageName

The name of a custom image in the app’s asset catalog. If the image is not in your app’s asset catalog, this method searches the app bundle for the image.

You do not need to specify the filename extension or the @2x or @3x modifiers for this name. This method retrieves the appropriate image based on the system and the available image resources.

Return Value

A Home screen quick action icon initialized with the specified template image provided by your app.

Discussion

Use this method to create icons based on custom artwork that you provide. If the image name you specify does not correspond to a valid image resource in your app bundle, no icon is displayed for the quick action that you associate the icon with.

Icons should be square, single color, and 35x35 points, as shown in these template files and as described in Template Images in UIKit User Interface Catalog and in iOS Human Interface Guidelines.

See Also

Creating a Quick Action Icon

init(type: UIApplicationShortcutIcon.IconType)

Creates a Home screen quick action icon using a system-defined image.

init(contact: CNContact)

Creates a Home screen quick action icon from the picture for a contact if available, or else creates a monogram from the contact name.