Search code examples
iosxcodeinterface-buildersf-symbols

Adapt SF Symbols to iOS version


I'm currently developing an iOS app that has iOS 13 set as deployment target. I'm using some SF symbols throughout the app. Now, since iOS 14 and a new version of XCode have been available, I've been getting a warning about one of my symbols being deprecated (paragraphsign should be used instead of paragraph), however, when I change the image to paragraphsign in Interface Builder, I'm getting an error saying that this symbol is only available in iOS 14...

Now, my current solution is to ignore the warning and instead use

if #available(iOS 14, *)
{
    ...
}

in my code to replace all deprecated images with their new versions.

My question is: Is there a way to do this in Interface Builder directly to avoid the warning? Something like "use this in iOS 14 and that in prior versions"?


Solution

  • One option, if you don't want to just ignore the warning...

    Using the SF Symbols app, select the "paragraphsign" and:

    File -> Export Custom Symbol Template
    

    Save it as paragraphsign.svg and then drag it into your asset catalog. That image will be used when running on iOS 13... the actual paragraphsign SF Symbol will be used when running on iOS 14.

    No code needed.