Use SF Symbols system image for static UIApplicationShortcutItem

后端 未结 3 835
灰色年华
灰色年华 2021-02-19 01:24

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 no

3条回答
  •  耶瑟儿~
    2021-02-19 02:08

    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:

    • SF Symbols are only available for native use on devices running iOS 13 or older.
    • 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:

    • Download the SF Symbols app from here.
    • Export the symbols you'd like to use as SVG files.
    • Add exported SVG files to your assets.
    • Use the asset name for the value of 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.

提交回复
热议问题