Skip to content

Commit

Permalink
Merge pull request #31 from piknotech/work/#28-readd-cocoapods-support
Browse files Browse the repository at this point in the history
Readd CocoaPods compatibility
  • Loading branch information
fredpi committed Jun 27, 2019
2 parents ac94d2e + 285abb8 commit 1fd13bd
Show file tree
Hide file tree
Showing 13 changed files with 786 additions and 710 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Expand Up @@ -11,11 +11,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

### Changed

- None
- Readd CocoaPods compatibility (By [Frederick Pietschmann](github.com/fredpi))
- Drop `UIImage(systemSymbol:compatibleWith:)` initializer (By [Frederick Pietschmann](github.com/fredpi))
- Drop `SFSymbol.toImage`, `SFSymbol.toImage(withConfiguration:)`,
`SFSymbol.toImage(compatibleWith:)` methods.
Use the `UIImage(systemSymbol:)` initializers instead (By [Frederick Pietschmann](github.com/fredpi))
- Adjust deployment targets (By [Frederick Pietschmann](github.com/fredpi))
- Improve documentation of available platforms and available initializers (By [Frederick Pietschmann](github.com/fredpi))
- Adjust file structure (By [Frederick Pietschmann](github.com/fredpi))
- Test different scales, weights and pointSizes (By [Frederick Pietschmann](github.com/fredpi))

### Fixed

- None
- Drop macOS support (that didn't work). (By [Thiago Holanda](https://github.com/unnamedd))

## [0.3.1] - 2019-06-22

Expand Down Expand Up @@ -70,4 +78,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
- Helper script to extract all icon names
- Helper script to create a Swift enum
- The generated Swift code plus a handy UIImage extension, and
- Test cases for all methods. All by [Frederick Pietschmann](https://github.com/fredpi).
- Test cases for all methods. All by [Frederick Pietschmann](https://github.com/fredpi).
2 changes: 1 addition & 1 deletion Package.swift
Expand Up @@ -4,7 +4,7 @@ import PackageDescription

let package = Package(
name: "SFSafeSymbols",
platforms: [.iOS(.v9), .tvOS(.v9), .watchOS(.v2)],
platforms: [.iOS(.v11), .tvOS(.v11), .watchOS(.v6)],
products: [
.library(name: "SFSafeSymbols", type: .static, targets: ["SFSafeSymbols"])
],
Expand Down
52 changes: 28 additions & 24 deletions README.md
Expand Up @@ -14,8 +14,8 @@
alt="Version: 0.3.1">
</a>
<a href="#">
<img src="https://img.shields.io/badge/Platforms-iOS-FF69B4.svg"
alt="Platforms: iOS">
<img src="https://img.shields.io/badge/Platforms-iOS%20|%20tvOS%20|%20watchOS-FF69B4.svg"
alt="Platforms: iOS – tvOS – watchOS">
</a>
<a href="https://github.com/piknotech/SFSafeSymbols/blob/stable/LICENSE.md">
<img src="https://img.shields.io/badge/license-MIT-lightgrey.svg" alt="License: MIT">
Expand All @@ -25,10 +25,13 @@
<img src="https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg" alt="SwiftPM: Compatible">
</a>
<a href="https://github.com/JamitLabs/Accio">
<img src="https://img.shields.io/badge/Accio-supported-0A7CF5.svg?style=flat" alt="Accio: supported">
<img src="https://img.shields.io/badge/Accio-supported-0A7CF5.svg?style=flat" alt="Accio: Supported">
</a>
<a href="https://github.com/Carthage/Carthage">
<img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage: compatible">
<img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage: Compatible">
</a>
<a href="https://cocoapods.org/pods/SFSafeSymbols">
<img src="https://img.shields.io/badge/CocoaPods-compatible-4BC51D.svg?style=flat" alt="CocoaPods: Compatible">
</a>
</p>

Expand All @@ -50,11 +53,13 @@ At WWDC 2019, Apple announced a new library of icons that come included with iOS
UIImage(systemName: "circle.fill")
```

It didn't take long until [first ideas came up](https://twitter.com/simjp/status/1135642837322588161?s=12) to make these icons accessible in a safe way using a framework. And this is just what this framework does!
It didn't take long until [first ideas came up](https://twitter.com/simjp/status/1135642837322588161?s=12) 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 Swift Package Manager, Accio, Carthage or CocoaPods:
`SFSafeSymbols` can be installed via Swift Package Manager, Accio, Carthage or CocoaPods.

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

### Swift Package Manager

Expand Down Expand Up @@ -82,41 +87,40 @@ Then run `carthage update`.

### CocoaPods

CocoaPods support is currently on hold as there are some compatibility issues. However, we are working eagerly to readd it as soon as possible. [This issue](https://github.com/piknotech/SFSafeSymbols/issues/28) will track progress on the matter.
Add the following entry to your Podfile:

```rb
pod 'SFSafeSymbols', '~> 0.3'
```

Then run `pod install`.

## Usage

All the system icons are accessible via the `SFSymbol` enum. They are named similar to Apple's naming, but use a lower camel case style and prefix names with leading numbers with a `_` character:
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
c.circle ~> SFSymbol.cCircle
e.circle.fill ~> SFSymbol.eCircleFill
11.circle.fill ~> SFSymbol._11CircleFill
```

You can now either create the corresponding `UIImage` by initializing it using the `SFSymbol`:
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?`:

```swift
UIImage(systemSymbol: .cCircle)
UIImage(systemSymbol: .eCircleFill, withConfiguration: /* Some UIImage.Configuration */)
UIImage(systemSymbol: ._11CircleFill, compatibleWith: /* Some UITraitCollection */)
```

Or by calling a function on your `SFSymbol` instance:

```swift
SFSymbol.cCircle.toImage
SFSymbol.eCircleFill.toImage(withConfiguration: /* Some UIImage.Configuration */)
SFSymbol._11CircleFill.toImage(compatibleWith: /* Some UITraitCollection */)
UIImage(systemSymbol: SFSymbol.eCircleFill)
UIImage(systemSymbol: ._11CircleFill, withConfiguration: /* Some UIImage.Configuration */)
```

You can also create a `SwiftUI.Image` by using new initializers that take a `SFSymbol` reference:
A SF Symbol `SwiftUI.Image` can also be initialized using the `SFSymbol` enum. It's also unwrapped, so you get a `SwiftUI.Image` instead of a `SwiftUI.Image?`:

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

**All symbols are tested** so you can be sure your code won't crash because an image couldn't be found!
**All symbols are tested via a CI**, so you can be sure your code won't crash because an image couldn't be found!

## Contributing

Expand Down
31 changes: 18 additions & 13 deletions SFSafeSymbols.podspec
@@ -1,19 +1,24 @@
Pod::Spec.new do |s|
Pod::Spec.new do |spec|
spec.name = 'SFSafeSymbols'
spec.version = '0.3.1'
spec.summary = "Safely access Apple's SF Symbols using static typing"

s.name = "SFSafeSymbols"
s.version = "0.3.0"
s.summary = "Safely access Apple's SF System Symbols using static typing"
spec.homepage = 'https://github.com/piknotech/SFSafeSymbols'
spec.license = { :type => 'MIT', :file => 'LICENSE.md' }

s.homepage = "https://github.com/piknotech/SFSafeSymbols"
s.license = { :type => "MIT", :file => "LICENSE.md" }
spec.author = { 'Frederick Pietschmann' => 'cocoapods@fredpi.de' }
spec.social_media_url = 'https://twitter.com/fredcpi'

s.author = { "Frederick Pietschmann" => "cocoapods@fredpi.de" }
s.social_media_url = "https://twitter.com/fredcpi"
spec.static_framework = true

s.ios.deployment_target = "10.0"
spec.ios.deployment_target = '11.0'
spec.tvos.deployment_target = '11.0'
spec.watchos.deployment_target = '6.0'

s.source = { :git => "https://github.com/piknotech/SFSafeSymbols.git", :tag => "#{s.version}" }
s.source_files = "Sources/SFSafeSymbols/*.swift"
s.framework = "UIKit"
s.swift_version = "5.1"
spec.swift_version = '5.1'

spec.source = { :git => 'https://github.com/piknotech/SFSafeSymbols.git', :tag => '#{spec.version}' }
spec.source_files = 'Sources/**/*'

spec.frameworks = 'SwiftUI', 'UIKit'
end

0 comments on commit 1fd13bd

Please sign in to comment.