From 362bfaf7e49f9d4bec71975487e2fd0d376a09e1 Mon Sep 17 00:00:00 2001 From: Philippe Peirano Date: Tue, 11 Aug 2020 14:33:04 +0200 Subject: [PATCH] Renamed to ColorPickerRing to avoid collision with iOS 14 ColorPicker --- .gitignore | 2 ++ Package.swift | 8 ++++---- README.md | 8 ++++---- .../{ColorPicker => ColorPickerRing}/ColorExtension.swift | 2 +- .../ColorPickerRing.swift} | 6 +++--- 5 files changed, 14 insertions(+), 12 deletions(-) rename Sources/{ColorPicker => ColorPickerRing}/ColorExtension.swift (98%) rename Sources/{ColorPicker/ColorPicker.swift => ColorPickerRing/ColorPickerRing.swift} (96%) diff --git a/.gitignore b/.gitignore index 02c0875..e5f3c58 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /.build /Packages /*.xcodeproj +.swiftpm/xcode/package.xcworkspace/xcuserdata +.swiftpm/xcode/xcuserdata diff --git a/Package.swift b/Package.swift index 79d83d6..3f592b8 100644 --- a/Package.swift +++ b/Package.swift @@ -4,7 +4,7 @@ import PackageDescription let package = Package( - name: "ColorPicker", + name: "ColorPickerRing", platforms: [ .macOS(SupportedPlatform.MacOSVersion.v10_15), .iOS(SupportedPlatform.IOSVersion.v13) @@ -12,8 +12,8 @@ let package = Package( products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( - name: "ColorPicker", - targets: ["ColorPicker"]), + name: "ColorPickerRing", + targets: ["ColorPickerRing"]), ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -24,7 +24,7 @@ let package = Package( // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( - name: "ColorPicker", + name: "ColorPickerRing", dependencies: ["DynamicColor"]), ] ) diff --git a/README.md b/README.md index efb7e62..f71478b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ColorPicker +# ColorPickerRing A color picker implementation with color wheel appearance written in plain SwiftUI. It is compatible with UIColor and NSColor. @@ -8,18 +8,18 @@ A color picker implementation with color wheel appearance written in plain Swift Add this repository as a Swift Package Dependency to your project. You find the option in Xcode unter "File > Swift Packages > Add Package Dependency...". Paste the HTTPS reference to this repo and you're done! -After importing the module: Simply use the `ColorPicker` structure which is a regular SwiftUI `View`. +After importing the module: Simply use the `ColorPickerRing` structure which is a regular SwiftUI `View`. This project uses the [DynamicColor](https://github.com/yannickl/DynamicColor) dependency which lets you write plattform independant color classes. No matter if iOS or macOS. Internally it uses `UIColor` and `NSColor`. ``` import SwiftUI -import ColorPicker +import ColorPickerRing struct ContentView: View { @State var color = UIColor.red var body: some View { - ColorPicker(color: $color, strokeWidth: 30) + ColorPickerRing(color: $color, strokeWidth: 30) .frame(width: 300, height: 300, alignment: .center) } } diff --git a/Sources/ColorPicker/ColorExtension.swift b/Sources/ColorPickerRing/ColorExtension.swift similarity index 98% rename from Sources/ColorPicker/ColorExtension.swift rename to Sources/ColorPickerRing/ColorExtension.swift index aba228a..71a8556 100644 --- a/Sources/ColorPicker/ColorExtension.swift +++ b/Sources/ColorPickerRing/ColorExtension.swift @@ -1,6 +1,6 @@ // // ColorExtension.swift -// ColorPicker +// ColorPickerRing // // Created by Hendrik Ulbrich on 16.07.19. // diff --git a/Sources/ColorPicker/ColorPicker.swift b/Sources/ColorPickerRing/ColorPickerRing.swift similarity index 96% rename from Sources/ColorPicker/ColorPicker.swift rename to Sources/ColorPickerRing/ColorPickerRing.swift index 67341cf..7df3481 100644 --- a/Sources/ColorPicker/ColorPicker.swift +++ b/Sources/ColorPickerRing/ColorPickerRing.swift @@ -1,6 +1,6 @@ // -// ColorPicker.swift -// ColorPicker +// ColorPickerRing.swift +// ColorPickerRing // // Created by Hendrik Ulbrich on 15.07.19. // @@ -12,7 +12,7 @@ import SwiftUI import DynamicColor -public struct ColorPicker : View { +public struct ColorPickerRing : View { public var color: Binding public var strokeWidth: CGFloat = 30