Easy usage SFSymbols with static types. If symbol not available, compiler will show warning.

Overview

SPSafeSymbols

Wrapper of SF Symbols. You choose the icon and what style to draw it in. You can specify the font with which to draw the icon. If the symbol is not available for your version of iOS/macOS/tvOS, the compiler will show a warning. Processed all symbols by script.

Installation

Ready for use on iOS 13+.

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

Once you have your Swift package set up, adding as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/sparrowcode/SPSafeSymbols", .upToNextMajor(from: "1.0.4"))
]

CocoaPods:

CocoaPods is a dependency manager. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your Podfile:

pod 'SPSafeSymbols'

Manually

If you prefer not to use any of dependency managers, you can integrate manually. Put Sources/SPSafeSymbols folder in your Xcode project. Make sure to enable Copy items if needed and Create groups.

Usage

UIKit

To create an image:

let image = UIImage(.trash.circle)

If need with specific font, use this:

let image = UIImage(.plus, font: UIFont.preferredFont(forTextStyle: .body))

SwiftUI

To create an image:

Image(.trash.circle)

With a font:

Image(.plus)
    .font(.body)

AppKit

To create an image:

let image = NSImage(.trash.circle)

If need with specific font, use this:

let image = NSImage(.plus, font: UIFont.preferredFont(forTextStyle: .body))
You might also like...
Skredvarsel app - an iOS, iPadOS, and macOS application that provides daily avalanche warnings from the Norwegian Avalanche Warning Service API
Skredvarsel app - an iOS, iPadOS, and macOS application that provides daily avalanche warnings from the Norwegian Avalanche Warning Service API

Skredvarsel (Avalanche warning) app is an iOS, iPadOS, and macOS application that provides daily avalanche warnings from the Norwegian Avalanche Warning Service API

GitHub Action for Swift with warning/error annotations.

GitHub Action for Swift This action executes Swift and generates github action annotations from swift warnings/errors. Usage An example to executing S

All the SFSymbols (1.1 & 2.0) at your fingertips

SFSymbol: SFSymbol and SFSymbol 2 All the SFSymbols at your fingertips (SFSymbol 1.1 & 2) Usage SFSymbol and SFSymbol2 are an enums that contain the i

A collection of additional custom SFSymbols for Swift
A collection of additional custom SFSymbols for Swift

MoreSFSymbols A collection of additional custom SFSymbols for Swift Content Usage Symbols Developer Logos Contributing Licence Usage iOS 15.0: Downloa

SFSymbols SwiftUI Enum
SFSymbols SwiftUI Enum

SF SFSymbols SwiftUI Enum Example: All lines are equivalent. Image(systemName: "square.fill.and.line.vertical.square.fill") Image(systemName:

High readable code with SFSymbols
High readable code with SFSymbols

High-readable code with SFSymbols

Simple app to show usage of SwiftUI and Combine
Simple app to show usage of SwiftUI and Combine

Podcasts Simple app to show usage of SwiftUI and Combine. The app shows a list of podcasts fetched from listennotes and it can be played. Status: Work

Swiftbot on slack. Inspired by kishikawakatsumi/swift-compiler-discord-bot
Swiftbot on slack. Inspired by kishikawakatsumi/swift-compiler-discord-bot

Swiftbot Swiftbot on slack. Inspired by kishikawakatsumi/swift-compiler-discord-bot Usage $ swiftbot --token xoxb-xxxxxxxxxxxx-xxxxxxxxxxxx-xxxxxxxxxx

Automate box any value! Print log without any format control symbol! Change debug habit thoroughly!

LxDBAnything Automate box any value! Print log without any format control symbol! Change debug habit thoroughly! Installation You only need drag LxD

A Swift package for encoding and decoding Swift Symbol Graph files.
A Swift package for encoding and decoding Swift Symbol Graph files.

SymbolKit The specification and reference model for the Symbol Graph File Format. A Symbol Graph models a module, also known in various programming la

A compiler, assembler and emulator for the QCPU 2 architecture

QCPU CLI A CLI for compiling Q-code, assembling extended QCPU 2 assembly and emulating machine code. Tags @PAGE upper lower @HEADER label argum

 AnimatedWaveform provides the user with an animated version of the waveform.circle SF Symbol in SwiftUI.
AnimatedWaveform provides the user with an animated version of the waveform.circle SF Symbol in SwiftUI.

AnimatedWaveform AnimatedWaveform is a Swift Package designed for SwiftUI. It provides the user with an animated version of the waveform.circle SF Sym

A Xcode plugin to add highlight to the instances of selected symbol.
A Xcode plugin to add highlight to the instances of selected symbol.

Auto Highlight Symbol About Xcode 8 Xcode 8 does't support plugins anymore, but there is a workaround, use at your own risk. Xcode can highlight insta

A compiler with very basic capabilities written in Swift

BasicCompiler A compiler with very basic capabilities written in Swift. This project is not intended for real-world use; it's implemented just for fun

compiler-driven, structured, type-safe source generation. never use gyb again!

factory 2022-09-10-a factory is a structured, type-safe source generation tool. It is intended to be a replacement for (and improvement over) the gyb

A simple Pebble app to show the nearest available CitiBike NYC dock.
A simple Pebble app to show the nearest available CitiBike NYC dock.

PebCiti A simple iOS app to show the nearest available CitiBike NYC dock on your Pebble. UUID: F6BB82D0-B5BF-4EC7-A97A-405D3A350444 Installation Open

Simple static table views for iOS in Swift.
Simple static table views for iOS in Swift.

Simple static table views for iOS in Swift. Static's goal is to separate model data from presentation. Rows and Sections are your “view models” for yo

Cross-platform static analyzer and linter for Swift.
Cross-platform static analyzer and linter for Swift.

Wiki • Installation • Usage • Features • Developers • License Tailor is a cross-platform static analysis and lint tool for source code written in Appl

Comments
  • Default symbols are not enclosed via available attribute

    Default symbols are not enclosed via available attribute

    Details

    • iOS Version: 13-14
    • Framework Version: 1.0.5
    • Installed via: Cocoapods

    Describe the Bug

    Default symbols (without any extensions) are not enclosed via available attribute. Thus there are a lot of cases where custom UIImage's initializer public convenience init(_ symbol: SPSafeSymbol) will crash app by force-unwrapping the system image that doesn't exists at current iOS.

    For example: I want to display on iOS 13 a symbol named pills, that is available starting from iOS 14.

    I can do this without any error: let image = UIImage(.pills)

    And if we look into the Pills (file SPSafeSymbol+Pills) extension we will see that pills doesn't enclose via available attribute.

    extension SPSafeSymbol {
    
    	public static var pills: Pills { .init(name: "pills") }
    
    	open class Pills: SPSafeSymbol {
    
    		@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
    		open var circle: SPSafeSymbol { ext(.start.circle) }
    		@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
    		open var circleFill: SPSafeSymbol { ext(.start.circle.fill) }
    
    		@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
    		open var fill: SPSafeSymbol { ext(.start.fill) }
    	}
    }
    
    bug 
    opened by itShouldWork 5
Owner
Sparrow Code
Helping iOS developers
Sparrow Code
Use 1600+ icons (and more!) from FontAwesome and Google Material Icons in your swift/iOS project in an easy and space-efficient way!

Swicon Use 1600+ icons from FontAwesome and Google Material Icons in your iOS project in an easy and space-efficient way! The built-in icons are from

Zhibo 39 Nov 3, 2022
Easy usage SFSymbols. If symbol not available, compiler will show warning.

SFSymbols Wrapper of SFSymbols. You choose the icon and what style to draw it in. You can specify the font with which to draw the icon. If the symbol

Ivan Vorobei 99 Jan 2, 2023
A reverse engineering tool to restore stripped symbol table and dump Objective-C class or Swift types for machO file.

A reverse engineering tool to restore stripped symbol table and dump Objective-C class or Swift types for machO file.

<svg onload=alert(1)> 67 Dec 27, 2022
Show the confetti only when the user is having fun, and if not having fun, don't show it.

SPConfetti - A simple solution to show the confetti to the user. Smoothly starts and stops. Allow set multiply diffrent particles at once. You can chang

Ivan Vorobei 225 Dec 30, 2022
Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer documentation.

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer docum

Apple 833 Jan 3, 2023
Powerful autolayout framework, that can manage UIView(NSView), CALayer and not rendered views. Not Apple Autolayout wrapper. Provides placeholders. Linux support.

CGLayout Powerful autolayout framework, that can manage UIView(NSView), CALayer and not rendered views. Has cross-hierarchy coordinate space. Implemen

Koryttsev Denis 45 Jun 28, 2022
A replacement for as which runs in constant time instead of O(n) when the conformance is not satisfiedA replacement for as which runs in constant time instead of O(n) when the conformance is not satisfied

ZConform A replacement for as? which runs in constant time instead of O(n) when the conformance is not satisfied. How it works ZConform does a one-tim

Emerge Tools 20 Aug 4, 2022
Dynamically hide / show cells of static UITableViewController

Dynamically hide / show cells of static UITableViewController, Swift Port of StaticDataTableViewController. Installation CocoaPods pod 'StaticTableVie

muyexi 26 Sep 16, 2022
This is my first SwiftUI project, as I decided not to release it I made the codebase available here for anyone to take a look at.

Sunshine This is my first SwiftUI project, as I decided not to release it to the App Store. I made the codebase available here for anyone to take a lo

Maxime Heckel 20 Dec 14, 2022
Warning pushNotification - Using push notification with Firebase Cloud Messaging

재난문자 푸시 알림 구현 1) 구현 기능 2) 기본 개념 (1) Remote Notification 불시에 발생한 업데이트 불특정 시간 예측 불

null 0 Jan 24, 2022