SFSafeSymbols / SFSafeSymbols

Safely access Apple's SF Symbols using static typing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a secured nullable constructor for SFSymbol.

ShikiSuen opened this issue · comments

Currently, if I want to use circled numbers in a for-loop, I have to use this approach:

                                    let matchedSymbol = SFSymbol(rawValue: "\(index + 1).circle")
                                    if SFSymbol.allSymbols.contains(matchedSymbol) {

What if SFSymbol(maybeRawValue: String) which returns a nullable SFSymbol?
This can simplify the things above into:

if let matchedSymbol = SFSymbol(maybeRawValue: "\(index + 1).circle") {

FYI.