diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..0d2b9e2 --- /dev/null +++ b/Package.swift @@ -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] +) diff --git a/README.md b/README.md index 56d634c..2c3cedd 100644 --- a/README.md +++ b/README.md @@ -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 and import the platform specific library to the project: + +```swift +import Hue +``` + ## Author [Hyper](http://hyper.no) made this with ❤️ diff --git a/Source/iOS+tvOS/UIColor+Hue.swift b/Source/iOS+tvOS/UIColor+Hue.swift index 09bb452..c3b608d 100644 --- a/Source/iOS+tvOS/UIColor+Hue.swift +++ b/Source/iOS+tvOS/UIColor+Hue.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit // MARK: - Color Builders @@ -245,3 +246,4 @@ public extension UIColor { return self.add(red: color.redComponent, green: color.greenComponent, blue: color.blueComponent, alpha: color.alphaComponent) } } +#endif diff --git a/Source/iOS+tvOS/UIImage+Hue.swift b/Source/iOS+tvOS/UIImage+Hue.swift index 3de79df..758e967 100644 --- a/Source/iOS+tvOS/UIImage+Hue.swift +++ b/Source/iOS+tvOS/UIImage+Hue.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit class CountedColor { @@ -174,3 +175,4 @@ extension UIImage { } } } +#endif diff --git a/Source/macOS/NSColor+Hue.swift b/Source/macOS/NSColor+Hue.swift index 17b9c1c..a54ffad 100644 --- a/Source/macOS/NSColor+Hue.swift +++ b/Source/macOS/NSColor+Hue.swift @@ -1,3 +1,4 @@ +#if canImport(AppKit) import AppKit // MARK: - Color Builders @@ -258,3 +259,4 @@ public extension NSColor { return self.add(red: color.getRed(), green: color.getGreen(), blue: color.getBlue(), alpha: color.getAlpha()) } } +#endif diff --git a/Source/macOS/NSImage+Hue.swift b/Source/macOS/NSImage+Hue.swift index 4951b72..85adee4 100644 --- a/Source/macOS/NSImage+Hue.swift +++ b/Source/macOS/NSImage+Hue.swift @@ -1,3 +1,4 @@ +#if canImport(AppKit) import AppKit class CountedColor { @@ -163,3 +164,4 @@ extension NSImage { detailColor ?? (isDarkBackgound ? whiteColor : blackColor)) } } +#endif