ptrkstr/symbols
Swift Package Information<br>
Features
- π« Contains all SF Symbols - 1.0, 2.0, 2.1, 3.0, 3.1
- π Supports all platforms: π± iOS, π» macOS, πΊ tvOS, βοΈ watchOS.
- π― 100% Test Coverage, every SF Symbol String extension is tested.
- π· Easy to maintain for future SF Symbol releases (see Maintenance section).
- β
Availability checks i.e.
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *). - π§΅ String extension which means you can use all the existing
UIImage/NSImageinitialisers. - π€ Camelcased allowing better code completion
Usage
import Symbols
// Swift >= 5.5
UIImage(systemName: .Symbols.magazineFill) // magazine.fill
NSImage(systemSymbolName: .Symbols.magazineFill, accessibilityDescription: nil) // magazine.fill
// Swift < 5.5
UIImage(systemName: String.Symbols.magazine) // magazine.fill
NSImage(systemSymbolName: String.Symbols.magazine, accessibilityDescription: nil) // magazine.fill
// Leading numbers prefixed with underscore
UIImage(systemName: .Symbols._0CircleFill) // 0.circle.fill
NSImage(systemSymbolName: .Symbols._0CircleFill, accessibilityDescription: nil) // 0.circle.fillInstallation
SPM
Add the following to your project:
https://github.com/ptrkstr/SymbolsMaintenance
All terminal commands must be ran from the directory of this repo.
Update raw.txt
- Enter the following into terminal but don't press enter yet
`` pbpaste > ./Generator/Sources/Generator/Resources/raw.txt ``
- Open SF Symbols
- Select all, right click, select "Copy X Names"
- Press enter in terminal
Update name_availability.plist
yes | cp /Applications/SF\ Symbols.app/Contents/Resources/name_availability.plist ./Generator/Sources/Generator/ResourcesGenerate
cd Generator; swift run; cd ..Aren't there already packages like this?
Yep! But for one reason or another, they didn't fulfil my needs (as of 2021/11/05).
- lennet/Symbols - No updates since June 2019
- piknotech/SFSafeSymbols - Missing support for SF Symbols 3 (issue since 8 June 2021)
- abadikaka/SFSymbolsFinder - Feature rich package but I wanted something lean
- jollyjinx/SFSymbolEnum - Swift package index shows build breaking with iOS
- justMaku/Symbolic - No updates since June 2019
- omeasraf/SFIcons - Swift package index shows build breaking with iOS
TODO
- [ ] Show symbol in code completion
Package Metadata
Repository: ptrkstr/symbols
Default branch: master
README: README.md