All Projects → piknotech → Sfsafesymbols

piknotech / Sfsafesymbols

Licence: mit
Safely access Apple's SF Symbols using static typing

Programming Languages

swift
15916 projects
symbols
36 projects

Labels

Projects that are alternatives of or similar to Sfsafesymbols

Azure Design
Here you will find my complete Azure Visio Stencil and bonus SVG and PNG versions for all of the Azure Service and configuration items.
Stars: ✭ 470 (-31.19%)
Mutual labels:  icons
Mbicons
MBIcons contains over 200 icons that can be resized to any dimensions as they are drawn using NSBezierPath.
Stars: ✭ 537 (-21.38%)
Mutual labels:  icons
Vscode Icons
Icons for Visual Studio Code
Stars: ✭ 627 (-8.2%)
Mutual labels:  icons
Pokesprite
Database project of box and inventory sprites from the Pokémon core series games
Stars: ✭ 489 (-28.4%)
Mutual labels:  icons
Iconfontcppheaders
C, C++ headers and C# classes for icon fonts: Font Awesome, Fork Awesome, Material Design, Kenney game icons and Fontaudio
Stars: ✭ 509 (-25.48%)
Mutual labels:  icons
Evil Icons
Simple and clean SVG icon pack with the code to support Rails, Sprockets, Node.js, Gulp, Grunt and CDN
Stars: ✭ 4,944 (+623.87%)
Mutual labels:  icons
Suru Icon Theme
The source of the Suru icon and cursor set
Stars: ✭ 458 (-32.94%)
Mutual labels:  icons
Payment Icons
💳 Payment / Ecommerce related svg icon packs
Stars: ✭ 671 (-1.76%)
Mutual labels:  icons
Ngx Ui
🚀 Style and Component Library for Angular
Stars: ✭ 534 (-21.82%)
Mutual labels:  icons
React Native Make
A collection of everyday React Native CLI tools
Stars: ✭ 606 (-11.27%)
Mutual labels:  icons
Awesome Meta And Manifest
⚡ Awesome collection of meta tags & manifest properties.
Stars: ✭ 499 (-26.94%)
Mutual labels:  icons
App Icon
Icon management for Mobile Apps. Create icons, generate all required sizes, label and annotate. Supports Native, Cordova, React Native, Xamarin and more. Inspired by cordova-icon.
Stars: ✭ 504 (-26.21%)
Mutual labels:  icons
Appiconnamechanger
Library to change Android launcher App Icon and App Name programmatically !
Stars: ✭ 555 (-18.74%)
Mutual labels:  icons
Ant Design Icons
⭐ Ant Design SVG Icons
Stars: ✭ 484 (-29.14%)
Mutual labels:  icons
Lsd
The next gen ls command
Stars: ✭ 6,655 (+874.38%)
Mutual labels:  icons
Logo Ls
Modern ls command with vscode like File Icon and Git Integrations. Written in Golang
Stars: ✭ 465 (-31.92%)
Mutual labels:  icons
Academicons
An icon font for academics
Stars: ✭ 541 (-20.79%)
Mutual labels:  icons
Flyingfox
An opinionated set of configurations for firefox.
Stars: ✭ 669 (-2.05%)
Mutual labels:  icons
Browser Logos
🗂 High resolution web browser logos
Stars: ✭ 5,538 (+710.83%)
Mutual labels:  icons
Icons
All SVG icons available on http://game-icons.net
Stars: ✭ 598 (-12.45%)
Mutual labels:  icons

Build Status Swift: 5 Version: 2.1.3 Platforms: iOS – tvOS – watchOS – macOS License: MIT
SwiftPM: Compatible Carthage: Compatible CocoaPods: Compatible

Supported VersionsMotivationInstallationUsageContributingLicenseIssuesPull Requests

Supported Versions

SFSafeSymbols supports multiple SF Symbols versions at the same time by utilizing the @availability flag. The following versions are currently supported:

  • SF Symbols 2.1 (@available(iOS 14.2, macOS 11.0, tvOS 14.2, watchOS 7.1, *))
  • SF Symbols 2.0 (@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *))
  • SF Symbols 1.0 (@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *))

Motivation

At WWDC 2019, Apple announced a new library of icons that came included with that year's new operating system versions. To browse them, there's even a dedicated Mac app called SF Symbols. However, developers still have to copy the name of an icon and reference it unsafely, resulting in code like this:

UIImage(systemName: "circle.fill")

It didn't take long until first ideas came up to make these icons accessible in a safe way using a framework. And this is just what SFSafeSymbols does!

Installation

SFSafeSymbols can be installed via the Swift Package Manager (recommended), Carthage or CocoaPods.

Supported platforms are iOS (11.0+), tvOS (11.0+), watchOS (6.0+) and macOS (10.13+), although the actual functionality is of course only accessible starting with iOS 13.0, tvOS 13.0, watchOS 6.0 and macOS 11.0.

Swift Package Manager (Xcode-integrated)

To integrate SFSafeSymbols using the Xcode-built-in SPM, choose FileSwift PackagesAdd Package Dependency. Enter the following url: https://github.com/piknotech/SFSafeSymbols and click Next. When asked about the version, leave the preselection and click Next. In the following step, select SFSafeSymbols as the package product and click Finish unless you really want to use SFSafeSymbols-Dynamic and know what you are doing.

Swift Package Manager (standalone)

To integrate using the standalone version of Apple's Swift Package Manager, add the following as a dependency to your Package.swift:

.package(url: "https://github.com/piknotech/SFSafeSymbols.git", .upToNextMajor(from: "2.1.3"))

After specifying "SFSafeSymbols" as a dependency of the target in which you want to use it, run swift package update.

Carthage

Add the following entry to your Cartfile:

github "piknotech/SFSafeSymbols" ~> 2.1.3

Then run carthage update.

CocoaPods

Add the following entry to your Podfile:

pod 'SFSafeSymbols', '~> 2.1.3'

Then run pod install.

Usage

All the system icons are accessible via the SFSymbol enum. They are named similar to Apple's names, but use a lower camel case style and prefix names with leading numbers with a _ character:

c.circle        ~> SFSymbol.cCircle
e.circle.fill   ~> SFSymbol.eCircleFill
11.circle.fill  ~> SFSymbol._11CircleFill

A SF Symbol UIImage can now be initialized using the SFSymbol enum. This image is already unwrapped, so you get a UIImage instead of a UIImage?:

UIImage(systemSymbol: .cCircle)
UIImage(systemSymbol: SFSymbol.eCircleFill)
UIImage(systemSymbol: ._11CircleFill, withConfiguration: /* Some UIImage.Configuration */)

A SF Symbol SwiftUI.Image can also be initialized using the SFSymbol enum:

Image(systemSymbol: .cCircle)
Image(systemSymbol: SFSymbol.eCircleFill)

There are also SwiftUI.Label initializers:

Label("MyText", systemSymbol: .cCircle)
Label(LocalizedStringKey("my.text"), systemSymbol: SFSymbol.eCircleFill)

... and interfaces for UIButton:

let button = UIButton.systemButton(with: .cCircle, target: self, selector: #selector(testMethod))
button.setImage(.eCircleFill, for: .normal)

... and an initializer for UIApplicationShortcutItem:

UIApplicationShortcutIcon(systemSymbol: .cCircle)
UIApplicationShortcutIcon(systemSymbol: SFSymbol.eCircleFill)

... and finally also an initializer for AppKit's NSImage:

NSImage(systemSymbol: .cCircle)
NSImage(systemSymbol: SFSymbol.eCircleFill, accessibilityDescription: "some.description")

Testing

All symbols are tested via a CI (on the latest iOS & tvOS versions), so you can be sure your code won't crash because an image couldn't be found!

Contributing

Contributions are very much welcome! See CONTRIBUTING.md for more information.

License

This library is released under the MIT License. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].