When specifying home screen quick actions, UIApplicationShortcutItems
, in your Info.plist, is there a way to use a system image from SF Symbols?
The docs noting the available iOS keys doesn't specify a key to do this, besides specifying one of the predefined enum cases from UIApplicationShortcutItemIconType
such as UIApplicationShortcutIconTypeSearch
.
It is possible to use a system image when creating dynamic quick actions via a new initializer UIApplicationShortcutIcon.init(systemImageName: String)
. Is there a Info.plist key that allows this for static quick actions?
在 Info.plist 中使用UIApplicationShortcutItemIconSymbolName
而不是UIApplicationShortcutItemIconFile
。
There is a poor documented way and that is to use UIApplicationShortcutItemIconSymbolName
instead of UIApplicationShortcutItemIconFile
in the Info.plist
file.
Since there are not too many symbols that you need to use statically at the same time, here is the solution:
UIApplicationShortcutItemIconFile
:The second method also brings more benefits to your app:
More description here in these answer
I read the docs and tried several methods to get this working but the conclusion I reached is that this won't be possible for two main reasons:
Info.plist
file can specify a platform
and device
type but you can't specify an OS version. In Apple's documents it's also stated that:
You can use SF Symbols in apps running in iOS 13 and later, watchOS 6 and later, and tvOS 13 and later. To browse the full set of symbols, download the SF Symbols app.
This means that you are able to use these symbols but with a standard way. Here is what you can do:
UIApplicationShortcutItemIconFile
key.This may not be the method you'd have hoped but it's a valid solution for using SF Symbols as shortcut icons so I hope this works for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.