Swiftpack.co - littleossa/SFUserFriendlySymbols as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by littleossa.
littleossa/SFUserFriendlySymbols 0.4.0
This is user-friendly SF Symbols.
⭐️ 26
πŸ•“ 3 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/littleossa/SFUserFriendlySymbols.git", from: "0.4.0")

SFUserFriendlySymbols

SFUserFriendlySymbols

CI

This is USER-FRIENDLY SF Symbols.

You can use SF Symbols image without coding system names and if you select unavailable system image, you know it with the alert from Xcode.

β™₯️ Support SF Symbols version

Supported SF Symbols 3.3 now.

⬇️ Installation

Swift Package Manager(Recommended)

on Xcode, choose File β†’ Add Packages... β†’ type url: https://github.com/littleossa/SFUserFriendlySymbols.git in the searchbox. searchbox

tap Add Package if SFUserFriendlySymbols package appears.

You can also add this package to Package.swift, include it in your target dependencies.

let package = Package(
    dependencies: [
        .package(url: "https://github.com/littleossa/SFUserFriendlySymbols", .upToNextMajor(from: "0.2.2")),
    ],
    targets: [
        .target(
            name: "<your-target-name>",
            dependencies: ["SFUserFriendlySymbols"]),
    ]
)

πŸ“– How to use

At first, import SFUserFriendlySymbols.

β—† UIKit

for example, if you want use this system symbol named face.smiling

face-smiling

symbol names changed into lower camel cases in SFUserFriendlySymbols.

face.smiling -> faceSmiling

select lower camel cased symbols as the parameter in the initializer.

let image = UIImage(symbol: .faceSmiling)

unfortunately,there are some symbol names which start with numbers.

1Circle

the example is 1.circle.in this case,the enum case start with _.

let image = UIImage(symbol: ._1Circle)

β—† SwiftUI

Image(symbol: .faceSmiling)

β—† Categorized Symbols

There are 23 categories as with that you can see on SF Symbols App. they return symbols which can use on your target os version.

All Symbols

SFSymbols.allCases

or

SFSymbols.Category.all.symbols

Other categories

For example, when you use symbols categorized as Weather

let weatherSymbols = SFSymbols.Category.weather

or

let weatherSymbols = SFSymbols.weatherSymbols

❓ Why UserFriendly?

Why this name of SF Symbols library includes UserFriendly?

The symbol can't use and you can know with the alert on Xcode when your lower OS target version doesn't reach available version of the given symbol.

sfsymbols-alert

And also, you don't need to type system name when you intialize images with any symbols.

There is just one word. "Happy"

πŸ†• Features from iOS 15

You can set image palette-colored or hiralical-colored, muluticolored.

use this symbol "pc" as a sample this time.

pc

palette-colored

let image = UIImage(symbol: .pc, paletteColors: [.systemPink, .yellow])

palette-color

hierarchical-colored

let image = UIImage(symbol: .pc, hierarchicalColor: .systemPink)

hierirchcal-color

multicolored

if symbols have multicolor variant, the symbol's color prefers the multicolor when they initialize with UIImage(multiColoredSymbol:)

let image = UIImage(multiColoredSymbol: .pc)

multicolor

πŸ’‘ Contribution

Feel free to contribute from SF Symbols lovers.

License

This library is released under the MIT License.

Reference

I blogged about SFUserFriendlySymbols in Japanse.the link is below.

GitHub

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

Release Notes

Release 0.4.0
3 weeks ago

Support SF Symbols 3.3

  • Add New Symbols from SF Symbols 3.3
  • Update the category of What's new to the latest.

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