SF in Xojo

Is there an easy way to use SF symbols in Xojo ?

Do you use MBS Xojo Plugins?

We recently added imageWithSystemSymbolName method for NSImageMBS class to query picture for a symbol name.

@Christian_Schmitz has NSImageMBS documentation said it works for Mac, Console and Web not for iOS

Well, there is no plugin SDK for iOS in Xojo 2020r1.

For iOS, you can use iOSImage.SystemImage to retrieve them.

You’ll definitely want Apple’s SF Symbols app if you don’t have it.

3 Likes

Thank you @Gavin_Smith.

In ImageView open method I just write

me.Image = iOSImage.SystemImage("pencil",me.Width, iOSImage.SystemImageWeights.Regular)

And it works fine!

This only works in iOS 13 and above so I use:

If System.Version >= “13” Then
customCell.SFSymbolsIcon.Image = iOSImage.SystemImage(“list.bullet”,0,iosimage.SystemImageWeights.Regular,SymbolColorGroup,Nil)
Else
customCell.SFSymbolsIcon.Image = listicon
End If

You can set the fallback image also in iOSImage.SystemImage. Then it’s ready for iOS Versions < iOS 13 :wink:

@Martin_T sorry I don’t understood what you mean

Look here: iOSImage — Xojo documentation

iOSImage.SystemImage(name as Text, size as Double, weight as iOSImage.SystemImageWeights = SystemImageWeights.Regular, templateColor as ColorGroup = Nil, fallbackTemplateImage as iOSImage = nil) As iOSImage

Retrieves an SF Symbol on iOS 13+ and optionally colorizes it with the option of supplying a fallback template image for older versions of iOS, which will also be colorized.

Set Parameter fallbackTemplateImage with an Static Image and it should work fine for < iOS 13.

1 Like

Speaking of “optionally colorizes”, that currently doesn’t work.

<https://xojo.com/issue/58923>

I still assign a ColorGroup to it, in case it starts working in the future.