Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Swift Package #70

Merged
merged 3 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// swift-tools-version:5.1
import PackageDescription

let package = Package(
name: "Hue",
platforms: [
.iOS(.v8),
.macOS(.v10_11),
.tvOS(.v9),
],
products: [
.library(
name: "Hue",
targets: ["Hue"]),
],
targets: [
.target(
name: "Hue",
path: "Source"),
],
swiftLanguageVersions: [.v5]
)
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ To install just write into your Cartfile:
github "hyperoslo/Hue"
```

To install **Hue** using [Swift Package Manager](https://swift.org/package-manager) with Xcode 11, just follow the instructions at <https://developer.apple.com/documentation/swift_packages> and import the platform specific library to the project:

```swift
import Hue
```

## Author

[Hyper](http://hyper.no) made this with ❤️
Expand Down
2 changes: 2 additions & 0 deletions Source/iOS+tvOS/UIColor+Hue.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(UIKit)
import UIKit

// MARK: - Color Builders
Expand Down Expand Up @@ -245,3 +246,4 @@ public extension UIColor {
return self.add(red: color.redComponent, green: color.greenComponent, blue: color.blueComponent, alpha: color.alphaComponent)
}
}
#endif
2 changes: 2 additions & 0 deletions Source/iOS+tvOS/UIImage+Hue.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(UIKit)
import UIKit

class CountedColor {
Expand Down Expand Up @@ -174,3 +175,4 @@ extension UIImage {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Source/macOS/NSColor+Hue.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(AppKit)
import AppKit

// MARK: - Color Builders
Expand Down Expand Up @@ -258,3 +259,4 @@ public extension NSColor {
return self.add(red: color.getRed(), green: color.getGreen(), blue: color.getBlue(), alpha: color.getAlpha())
}
}
#endif
2 changes: 2 additions & 0 deletions Source/macOS/NSImage+Hue.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(AppKit)
import AppKit

class CountedColor {
Expand Down Expand Up @@ -163,3 +164,4 @@ extension NSImage {
detailColor ?? (isDarkBackgound ? whiteColor : blackColor))
}
}
#endif