/SFSymbolName

A swift package to have SF Symbols available as enum instead of verbatim strings.

Primary LanguageSwiftMIT LicenseMIT

SFSymbolName

A Swift package to have SF Symbols available as enum instead of strings.

Example

A list of all available symbols

import SwiftUI
import SFSymbolName

struct SFSymbolsView: View {
  var body: some View {
    VStack {
      List(SFSymbolName.allCases) { symbol in
        Label(LocalizedStringKey(symbol.rawValue), symbol: symbol)
      }
    }
  }
}

Advantages

  • Autocompletion all SFSymbols
  • Iterate through all available symbols

  • Images are available depending on OS and version like this:

Installation

Xcode

import SFSymbolEnum

XcodeGen

  • Add the package to the top-level packages key
packages:
  SFSymbolEnum:
    url: https://github.com/FullQueueDeveloper/SFSymbolName
    from: 3.0.1
  • Add the package to your target's dependencies list:
targets:
  App:
    type: application
    platform: iOS
    sources: [App]
    dependencies:
      - package: SFSymbolName

Generate the names

Swish script to generate the enum using the name_availablity.plist inside the SF Symbols application. Install Swish from HomeBrew, and run the generate script

brew tap fullqueuedeveloper/swish/swish
brew install swish
swish generate