Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sparrowcode/safesfsymbols

Safe access SFSymbols. If symbol not available, will show warning.
https://github.com/sparrowcode/safesfsymbols

awesome extension images safe safesymbols sanfrancisco sanfranciso-fonts sf-symbols sf-symbols-font sf-symbols-ios sfsymbols spm swiftui uiimage uikit

Last synced: 2 months ago
JSON representation

Safe access SFSymbols. If symbol not available, will show warning.

Awesome Lists containing this project

README

        

# SafeSFSymbols

Safe access SFSymbols. If symbol not available, will show warning.

```swift
// Replace this
UIImage(systemName: "star.fill")
// to this
UIImage(.star.fill)
```

### iOS Dev Community





## Navigate

- [Installation](#installation)
- [Swift Package Manager](#swift-package-manager)
- [CocoaPods](#cocoapods)
- [Manually](#manually)
- [Usage](#usage)
- [UIKit](#uikit)
- [SwiftUI](#swiftui)
- [AppKit](#appkit)

## Installation

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

### Swift Package Manager

In Xcode go to Project -> Your Project Name -> `Package Dependencies` -> Tap *Plus*. Insert url:

```
https://github.com/sparrowcode/SafeSFSymbols
```

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

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

### CocoaPods:

This is an outdated way. I advise you to use [SPM](#swift-package-manager). However, I will continue to support Cocoapods for some time.

Cocoapods Instalation

[CocoaPods](https://cocoapods.org) is a dependency manager. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your `Podfile`:

```ruby
pod 'SafeSFSymbols'
```

### Manually

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

## Usage

### UIKit

```swift
let image = UIImage(.trash.circle)
```

### SwiftUI

```swift
Image(.trash.circle)
```

### AppKit

```swift
let image = NSImage(.trash.circle)
```