Search code examples
iosxcodeios13ios14

System Image for UIButton appears in iOS14, but not in iOS13


I set system images for UIButtons and also in the tab bar. This works for iOS 14, but on iOS 13 the images are missing.

What could be the reason, for the system images to be missing on iOS 13?

Details:

I have a button with the image property set to "square.and.arrow.up" in the storyboard. (See screenshot below) The image appears on iOS 14, but not on iOS 13 (see screenshot below. Simulators overlapping)

Similar behaviour occurs for the tab bar items. (see other screenshot below)

Xcode is 12.5, MacOS 11.2.3, iOS Simulators 13.6 and 14.5. This happens on the devices too, not only in simulators.

The SF Symbols App claims that the icon is available since iOS 13+.

Any help is appreciated :-)

UIButton image property in storyboard

Appearance in two simulators

Appearance for tab bar items in simulators

Icon availability


Solution

  • It seems like a bug 🐞.

    ✅ Use this bug as a feature!

    Although it is a bug, it's a very good practice to always have a fallback for these kinds of ongoing stuff.

    So try to export the symbol (File -> Export..) and import it as an asset to the assets catalog.

    Note that although Xcode supports imported symbols, you may consider using a separated icon file (like a PDF) for older iOS devices.


    Besides it is more reliable, it will bring some other benefits to your project:

    1. Backward compatibility

    Since it uses the embedded assets in the bundle, they can be used even in iOS 12 and below.

    2. Forward compatibility!

    All versions of SF Symbols.app have come out as a beta app and Apple is constantly changing the conventions and rules and other aspects of creating and using these symbols.

    For example, take a look at this naming convention: Demo1

    As you can see, The name of this symbol is changed from iOS 15, and old codes will not show this in the future!

    3. Wider support

    You can use these exported symbols where there is no direct support for using symbols (like UIApplicationShortcutItem when it wasn't supported in the early versions and here is the full example)

    Wrap it up:

    So it is a good choice to always have backups of symbols and fall back to them if something went wrong...