Swiftpack.co - sparrowcode/SafeSFSymbols as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by sparrowcode.
sparrowcode/SafeSFSymbols 1.1.4
Easy usage SFSymbols with static types. If symbol not available, compiler will show warning.
⭐️ 90
🕓 1 week ago
iOS watchOS tvOS
.package(url: "https://github.com/sparrowcode/SafeSFSymbols.git", from: "1.1.4")

SafeSFSymbols

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

Installation

Ready to use on iOS 13+, tvOS 13+ & watchOS 6+

Swift Package Manager

In Xcode go to File -> Packages -> Update to Latest Package Versions and insert url:

https://github.com/sparrowcode/SafeSFSymbols

or adding it to the dependencies value of your Package.swift:

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

CocoaPods:

Specify it in your Podfile:

pod 'SafeSFSymbols'

Manually

If you prefer not to use any of dependency managers, you can integrate manually. Put Sources/SafeSFSymbols 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))

Apps Using

If you use a SafeSFSymbols, add your application via Pull Request.

GitHub

link
Stars: 90
Last commit: 6 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Fixed protect level for some symbols.
1 week ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics