UIImage from UIApplicationShortcutIcon

At https://developer.apple.com/ios/human-interface-guidelines/graphics/system-icons/ there are some great β€œquick steps.”

Is it possible to make UIImage from one of these UIApplicationShortcutIcon to use, say, a UIButton . For example, the mail icon:

 let mailIcon = UIApplicationShortcutIcon(type: .mail) let mailImage = UIImage( ... ) 

Any help would be greatly appreciated. Thanks.

+5
source share
2 answers

You cannot use Quick Action Icons as a regular image, or you cannot set a button image. This is only for hotkeys for 3D touch. When you click on the application icon and displays a context menu for quick action. You can use these icons here. Even this allows us to use our images as shortcuts.

You can also link to URLs as a link:

+4
source

These images are not available using the regular API, but they are part of the UIKit package. You can use a tool like iOS-Artwork-Extractor to extract 1x, 2x and 3x variants of these images, and then you can add them to your project.

+2
source

Source: https://habr.com/ru/post/1265906/


All Articles