Adapt SF Symbols to iOS version

675 Views Asked by At

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"?

2

There are 2 best solutions below

0
On BEST ANSWER

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.

1
On

Exporting from SF Symbols and then using this svg in asset catalog is working only if you use a name for Symbol image without dots ("."). For example: Symbol image name "speaker.wave.1.fill" won't work. Warning will disappear, but symbol will not show on WatchOS 6. When I renamed same Symbol Image to "Speaker1fill" and use this image instead of system image, it worked for all WatchOS versions.