Skip to content

Commit

Permalink
Implement support for SFSymbol 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Nirma committed Oct 31, 2024
1 parent 4154155 commit 1870d4d
Show file tree
Hide file tree
Showing 31 changed files with 52,633 additions and 2,487 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ on:
jobs:
smoke_test_build:
name: Smoke Test (Build only)
runs-on: macos-latest
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_16.app
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Build
run: xcodebuild
run: xcodebuild -scheme SFSymbol -target SFSymbol
- name: Test
run: xcodebuild test -scheme SFSymbol -target SFSymbolTests
79 changes: 79 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/SFSymbol.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SFSymbol"
BuildableName = "SFSymbol"
BlueprintName = "SFSymbol"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SFSymbolTests"
BuildableName = "SFSymbolTests"
BlueprintName = "SFSymbolTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SFSymbol"
BuildableName = "SFSymbol"
BlueprintName = "SFSymbol"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// swift-tools-version:5.1
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SFSymbol",
platforms: [
.macOS(.v10_13), .iOS(.v13), .tvOS(.v13), .watchOS(.v6),
.macOS(.v11), .iOS(.v15), .tvOS(.v15), .watchOS(.v6),
],
products: [
.library(
Expand Down
50 changes: 15 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,43 @@
# SFSymbol: SFSymbols 5 through 1.1
# SFSymbol: SFSymbols 6 through 1.1
![Build Status](https://github.com/nirma/sfsymbol/actions/workflows/build.yml/badge.svg)
[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-purple.svg)](https://github.com/apple/swift-package-manager)
[![CocoaPods compatible](https://img.shields.io/cocoapods/v/SFSymbol.svg)](#cocoapods)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)

All the SFSymbols at your fingertips (SFSymbol 5 through 1.1)
All the SFSymbols at your fingertips (SFSymbol 6 through 1.1)

![demo6](https://github.com/user-attachments/assets/5b1958b4-d3ab-4749-98c6-9b2fc04b33df)


## Usage
`SFSymbol5`, `SFSymbol4` and so on are an `enum`s that contain the identifier strings of all of apple's SFSymbols up to version 5.0.
`SFSymbol6`, `SFSymbol5` and so on are `enum`s that contain the identifier strings of all of apple's SFSymbols version 6 through 1.1.

For example `SFSymbol.playCircle` produces the `String` `"play.circle"` that can then be used to instantiate a system symbol via:
For example `SFSymbol6.Camera.cameraMeteringPartial.image` produces a SwiftUI `Image` or omitting the `.image` part will return an enum case with the associated raw value of `"camera.metering.partial"`.

#### UIKit

```swift
UIImage(symbol: SFSymbol4.Digitalcrown.arrowClockwiseFill)
```
https://github.com/user-attachments/assets/96eb227f-e34e-442c-b42f-e5826973030c

*or*

#### SwiftUI

```swift
Image(symbol: SFSymbol4.Digitalcrown.arrowClockwiseFill)
SFSymbol6.Camera.cameraMeteringPartial.image
```

*or*

## About
SFSymbols is a real treat from apple, Apple's official list of Symbols that are
available to use free of charge when writing software on any of Apple's recent platforms.
There is one downfall however, it is a pain in the neck to look up exact symbol names, take for example:

`"square.and.line.vertical.and.square.fill"`

That is a long string to remember and digging through the catalog of SF Symbols to find in would be quite a waste of time.

Wouldn't it be easier if you could just use code completion?
#### UIKit

![](https://media.giphy.com/media/jQ7lTLsv2poo2qLkUA/giphy.gif)
```swift
UIImage(symbol: SFSymbol6.Camera.cameraMeteringPartial)
```

Thats what this super micro library aims to do.

## Installation

### Swift Package Manager (Preferred)
Since Xcode integrated swift package manager natively into the IDE you can add SFSymbol simply by:

**`File`-> `Swift Packages` -> `Add Package Dependency...`**

when prompted to enter a package URL paste:

`https://github.com/Nirma/SFSymbol`


and click next & finish to automagically install SFSymbol through Xcode & SPM!

### Manual
Don't want that additional third party dependency? Then just simply copy over the file [`SFSymbol.swift`](https://github.com/Nirma/SFSymbol/blob/master/Sources/SFSymbol/SFSymbol.swift) into your project's appropriate folder!
Simply add a package to your project passing in `https://github.com/Nirma/SFSymbol` and your preferred version i.e `3.0`

### Cocoapods
Just add this line to your podfile:
Expand Down
6 changes: 3 additions & 3 deletions SFSymbol.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Pod::Spec.new do |s|
s.platform = :ios
s.ios.deployment_target = '13.0'
s.name = "SFSymbol"
s.summary = "SFSymbol - All the Symbols via code completion at your fingertips"
s.summary = "SFSymbol - All the SFSymbols 6 -> 1.1 via code completion at your fingertips"
s.requires_arc = true
s.version = "2.3.0"
s.version = "3.0.0"

s.license = { :type => "MIT", :file => "LICENSE" }

Expand All @@ -17,5 +17,5 @@ s.source = { :git => "https://github.com/Nirma/SFSymbol.git",
:tag => "#{s.version}" }

s.source_files = "Sources/SFSymbol/*.{swift}"
s.swift_version = "5.0"
s.swift_version = "6.0"
end
Loading

0 comments on commit 1870d4d

Please sign in to comment.