├── .github
└── FUNDING.yml
├── .gitignore
├── LICENSE
├── Package.swift
├── README.md
├── SwiftColorWheel.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── xcshareddata
│ └── xcschemes
│ ├── SwiftColorWheel.xcscheme
│ └── SwiftColorWheelExamples.xcscheme
├── SwiftColorWheel
├── ColorWheel.swift
├── ColorWheelLayer.swift
├── DefaultWheelGestureHandler.swift
├── Info.plist
├── RotatingColorWheel.swift
└── SwiftColorWheel.h
├── SwiftColorWheelExamples
├── AppDelegate.swift
├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x-1.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x-1.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x-1.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ ├── Icon-App-83.5x83.5@2x.png
│ │ └── icon.png
│ └── Contents.json
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── Info.plist
├── ViewController.swift
└── launchimage.png
├── appstore.svg
├── rotatingcolorwheel.gif
├── screenshot_1.png
├── screenshot_2.png
├── screenshot_3.png
└── screenshot_4.png
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [dmrschmidt]
4 | custom: ["https://www.buymeacoffee.com/dmrschmidt"]
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Adapted from https://github.com/github/gitignore/blob/master/Objective-C.gitignore
2 |
3 | # Finder
4 | .DS_Store
5 |
6 | # AppCode
7 | .idea
8 |
9 | # Xcode
10 | ## Build generated
11 | build/
12 | DerivedData/
13 |
14 | ## Various settings
15 | *.pbxuser
16 | !default.pbxuser
17 | *.mode1v3
18 | !default.mode1v3
19 | *.mode2v3
20 | !default.mode2v3
21 | *.perspectivev3
22 | !default.perspectivev3
23 | xcuserdata/
24 |
25 | ## Other
26 | *.moved-aside
27 | *.xccheckout
28 | *.xcscmblueprint
29 |
30 | ## Obj-C/Swift specific
31 | *.hmap
32 | *.ipa
33 | *.dSYM.zip
34 | *.dSYM
35 |
36 | ## Playgrounds
37 | timeline.xctimeline
38 | playground.xcworkspace
39 |
40 | # Swift Package Manager
41 | #
42 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
43 | # Packages/
44 | # Package.pins
45 | .build/
46 |
47 | # CocoaPods
48 | #
49 | # We recommend against adding the Pods directory to your .gitignore. However
50 | # you should judge for yourself, the pros and cons are mentioned at:
51 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
52 | #
53 | # Pods/
54 |
55 | # Carthage
56 | #
57 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
58 | # Carthage/Checkouts
59 |
60 | Carthage/Build
61 |
62 | # fastlane
63 | #
64 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
65 | # screenshots whenever they are needed.
66 | # For more information about the recommended setup visit:
67 | # https://docs.fastlane.tools/best-practices/source-control/#source-control
68 |
69 | fastlane/report.xml
70 | fastlane/Preview.html
71 | fastlane/screenshots
72 | fastlane/test_output
73 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:5.1
2 | // The swift-tools-version declares the minimum version of Swift required to build this package.
3 |
4 | import PackageDescription
5 |
6 | let package = Package(
7 | name: "SwiftColorWheel",
8 | platforms: [
9 | .iOS(.v9),
10 | ],
11 | products: [
12 | // Products define the executables and libraries a package produces, and make them visible to other packages.
13 | .library(
14 | name: "SwiftColorWheel",
15 | targets: ["SwiftColorWheel"]),
16 | ],
17 | dependencies: [
18 | // Dependencies declare other packages that this package depends on.
19 | // .package(url: /* package url */, from: "1.0.0"),
20 | ],
21 | targets: [
22 | // Targets are the basic building blocks of a package. A target can define a module or a test suite.
23 | // Targets can depend on other targets in this package, and on products in packages this package depends on.
24 | .target(
25 | name: "SwiftColorWheel",
26 | dependencies: [],
27 | path: "SwiftColorWheel"),
28 | ]
29 | )
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SwiftColorWheel
2 |
3 | [](https://github.com/Carthage/Carthage)
4 | [](https://swift.org/package-manager)
5 |
6 | A beautiful, customizable color wheel for iOS in Swift.
7 |
8 |
9 |
10 |
11 | # More related iOS Controls
12 |
13 | You may also find the following iOS controls written in Swift interesting:
14 |
15 | * [DSWaveformImage](https://github.com/dmrschmidt/DSWaveformImage) - draw an audio file's waveform image
16 | * [QRCode](https://github.com/dmrschmidt/QRCode) - a customizable QR code generator
17 |
18 | Also [check it out on CocoaControls](https://www.cocoacontrols.com/controls/swiftcolorwheel).
19 |
20 | If you really like this library (aka Sponsoring)
21 | ------------
22 | I'm doing all this for fun and joy and because I strongly believe in the power of open source. On the off-chance though, that using my library has brought joy to you and you just feel like saying "thank you", I would smile like a 4-year old getting a huge ice cream cone, if you'd support my via one of the sponsoring buttons ☺️💕
23 |
24 | If you're feeling in the mood of sending someone else a lovely gesture of appreciation, maybe check out my iOS app [💌 SoundCard](https://www.soundcard.io) to send them a real postcard with a personal audio message.
25 |
26 |
27 |
28 |
29 | # Installation
30 |
31 | ## Swift Package Manager
32 |
33 | Just add `https://github.com/dmrschmidt/SwiftColorWheel` and select "Up to Next Major"
34 |
35 | ## Carthage
36 |
37 | Simply add the following to your Cartfile and run `carthage update`:
38 |
39 | ```
40 | github "dmrschmidt/SwiftColorWheel", ~> 1.5
41 | ```
42 |
43 | # Usage
44 |
45 | Either, add a `ColorWheel` or `RotatingColorWheel` as a custom `UIView` subclass to your interface builder. Alternatively, you can of course simply add it programmatically as a subview to any normal `UIView`.
46 |
47 | This will already render your color picker. However it doesn't react on your taps yet. For that, set yourself as it's `delegate`. See the very simplified code example below:
48 |
49 | ```swift
50 | class MyViewController: UIViewController, ColorWheelDelegate {
51 | private var colorWheel: ColorWheel!
52 |
53 | override func viewDidLoad() {
54 | super.viewDidLoad()
55 |
56 | colorWheel = ColorWheel(frame: view.frame)
57 | colorWheel.delegate = self
58 | view.addSubview(colorWheel)
59 | }
60 |
61 | // MARK: - ColorWheelDelegate
62 |
63 | func didSelect(color: UIColor) {
64 | view.backgroundColor = color
65 | }
66 | }
67 | ```
68 |
69 | # Customization
70 |
71 | You can modify the look of the color wheel through various exposed properties.
72 |
73 | ```swift
74 | // Extra padding in points to the view border.
75 | colorWheel.padding = 13.0
76 |
77 | // Radius in point of the central color circle (for black & white shades).
78 | colorWheel.centerRadius = 5.0
79 |
80 | // Smallest circle radius in point.
81 | colorWheel.minCircleRadius = 1.0
82 |
83 | // Largest circle radius in point.
84 | colorWheel.maxCircleRadius = 5.0
85 |
86 | // Padding between circles in point.
87 | colorWheel.innerPadding = 3
88 |
89 | /**
90 | Degree by which each row of circles is shifted.
91 | A value of 0 results in a straight layout of the inner circles.
92 | A value other than 0 results in a slightly shifted, fractal-ish / flower-ish look.
93 | */
94 | colorWheel.shiftDegree = 0
95 |
96 | // Overall density of inner circles.
97 | colorWheel.density = 1.0
98 |
99 | // Stroke color highlighting currently selected color. Set nil to disable highlighting.
100 | // Default is UIColor.white.
101 | colorWheel.highlightStrokeColor = nil
102 | ```
103 |
104 | In some case (like when a `RotatingColorWheel` is placed inside a `UIScrollView`) you may want to tweak the default gesture handling for the rotation. If you do so, you can get access to the original gesture handler and use it in composition.
105 |
106 | ```swift
107 | let originalHandler = rotatingWheel.panRecognizer.delegate
108 | yourRetainedHandler = YourTweakedHandler(complementing: originalHandler)
109 | rotatingWheel.panRecognizer.delegate = yourRetainedHandler
110 | rotatingWheel.rotateRecognizer.delegate = yourRetainedHandler
111 | ```
112 |
113 | `YourTweakedHandler` could then implement `gestureRecognizerShouldBegin(_:)` in conjunction with the originally provided handler.
114 |
115 | ## See it live in action
116 |
117 | [SoundCard - postcards with sound](https://www.soundcard.io) lets you send real, physical postcards with audio messages. Right from your iOS device.
118 |
119 | SwiftColorWheel is used to color the waveform derived from the audio message on postcards sent by [SoundCard - postcards with audio](https://www.soundcard.io).
120 |
121 |
122 |
123 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/SwiftColorWheel.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 50;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | C32C9B24207433F500EE5634 /* SwiftColorWheel.h in Headers */ = {isa = PBXBuildFile; fileRef = C32C9B16207433F500EE5634 /* SwiftColorWheel.h */; settings = {ATTRIBUTES = (Public, ); }; };
11 | C32C9B302074356100EE5634 /* ColorWheel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32C9B2D2074356000EE5634 /* ColorWheel.swift */; };
12 | C32C9B312074356100EE5634 /* RotatingColorWheel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32C9B2E2074356000EE5634 /* RotatingColorWheel.swift */; };
13 | C32C9B322074356100EE5634 /* ColorWheelLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32C9B2F2074356100EE5634 /* ColorWheelLayer.swift */; };
14 | C32C9B3A2074357F00EE5634 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32C9B392074357F00EE5634 /* AppDelegate.swift */; };
15 | C32C9B3C2074357F00EE5634 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32C9B3B2074357F00EE5634 /* ViewController.swift */; };
16 | C32C9B3F2074357F00EE5634 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C32C9B3D2074357F00EE5634 /* Main.storyboard */; };
17 | C32C9B412074358100EE5634 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C32C9B402074358100EE5634 /* Assets.xcassets */; };
18 | C32C9B442074358100EE5634 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C32C9B422074358100EE5634 /* LaunchScreen.storyboard */; };
19 | C32C9B4D2074374C00EE5634 /* SwiftColorWheel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C32C9B13207433F500EE5634 /* SwiftColorWheel.framework */; };
20 | C348710020752186007B57E3 /* DefaultWheelGestureHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34870FF20752186007B57E3 /* DefaultWheelGestureHandler.swift */; };
21 | E1C4E94B2133B85400FFB951 /* launchimage.png in Resources */ = {isa = PBXBuildFile; fileRef = E1C4E94A2133B85400FFB951 /* launchimage.png */; };
22 | /* End PBXBuildFile section */
23 |
24 | /* Begin PBXContainerItemProxy section */
25 | C32C9B4A2074371E00EE5634 /* PBXContainerItemProxy */ = {
26 | isa = PBXContainerItemProxy;
27 | containerPortal = C32C9B0A207433F500EE5634 /* Project object */;
28 | proxyType = 1;
29 | remoteGlobalIDString = C32C9B12207433F500EE5634;
30 | remoteInfo = SwiftColorWheel;
31 | };
32 | /* End PBXContainerItemProxy section */
33 |
34 | /* Begin PBXCopyFilesBuildPhase section */
35 | 42016CA3214B9954009CAA6C /* Copy Frameworks */ = {
36 | isa = PBXCopyFilesBuildPhase;
37 | buildActionMask = 2147483647;
38 | dstPath = "";
39 | dstSubfolderSpec = 10;
40 | files = (
41 | );
42 | name = "Copy Frameworks";
43 | runOnlyForDeploymentPostprocessing = 0;
44 | };
45 | /* End PBXCopyFilesBuildPhase section */
46 |
47 | /* Begin PBXFileReference section */
48 | C32C9B13207433F500EE5634 /* SwiftColorWheel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftColorWheel.framework; sourceTree = BUILT_PRODUCTS_DIR; };
49 | C32C9B16207433F500EE5634 /* SwiftColorWheel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftColorWheel.h; sourceTree = ""; };
50 | C32C9B17207433F500EE5634 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
51 | C32C9B2D2074356000EE5634 /* ColorWheel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorWheel.swift; sourceTree = ""; };
52 | C32C9B2E2074356000EE5634 /* RotatingColorWheel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RotatingColorWheel.swift; sourceTree = ""; };
53 | C32C9B2F2074356100EE5634 /* ColorWheelLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorWheelLayer.swift; sourceTree = ""; };
54 | C32C9B372074357F00EE5634 /* SwiftColorWheelExamples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftColorWheelExamples.app; sourceTree = BUILT_PRODUCTS_DIR; };
55 | C32C9B392074357F00EE5634 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
56 | C32C9B3B2074357F00EE5634 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
57 | C32C9B3E2074357F00EE5634 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
58 | C32C9B402074358100EE5634 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
59 | C32C9B432074358100EE5634 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
60 | C32C9B452074358100EE5634 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
61 | C34870FF20752186007B57E3 /* DefaultWheelGestureHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultWheelGestureHandler.swift; sourceTree = ""; };
62 | E1BD5F7C2133B39600B63F62 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; };
63 | E1BD5F7D2133B39600B63F62 /* screenshot_3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = screenshot_3.png; sourceTree = ""; };
64 | E1BD5F7E2133B39600B63F62 /* screenshot_4.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = screenshot_4.png; sourceTree = ""; };
65 | E1BD5F7F2133B39600B63F62 /* screenshot_1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = screenshot_1.png; sourceTree = ""; };
66 | E1BD5F802133B39700B63F62 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = ""; };
67 | E1BD5F812133B39700B63F62 /* screenshot_2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = screenshot_2.png; sourceTree = ""; };
68 | E1C4E94A2133B85400FFB951 /* launchimage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = launchimage.png; sourceTree = ""; };
69 | /* End PBXFileReference section */
70 |
71 | /* Begin PBXFrameworksBuildPhase section */
72 | C32C9B0F207433F500EE5634 /* Frameworks */ = {
73 | isa = PBXFrameworksBuildPhase;
74 | buildActionMask = 2147483647;
75 | files = (
76 | );
77 | runOnlyForDeploymentPostprocessing = 0;
78 | };
79 | C32C9B342074357F00EE5634 /* Frameworks */ = {
80 | isa = PBXFrameworksBuildPhase;
81 | buildActionMask = 2147483647;
82 | files = (
83 | C32C9B4D2074374C00EE5634 /* SwiftColorWheel.framework in Frameworks */,
84 | );
85 | runOnlyForDeploymentPostprocessing = 0;
86 | };
87 | /* End PBXFrameworksBuildPhase section */
88 |
89 | /* Begin PBXGroup section */
90 | C32C9B09207433F500EE5634 = {
91 | isa = PBXGroup;
92 | children = (
93 | E1BD5F802133B39700B63F62 /* LICENSE */,
94 | E1BD5F7C2133B39600B63F62 /* README.md */,
95 | E1BD5F7F2133B39600B63F62 /* screenshot_1.png */,
96 | E1BD5F812133B39700B63F62 /* screenshot_2.png */,
97 | E1BD5F7D2133B39600B63F62 /* screenshot_3.png */,
98 | E1BD5F7E2133B39600B63F62 /* screenshot_4.png */,
99 | C32C9B15207433F500EE5634 /* SwiftColorWheel */,
100 | C32C9B382074357F00EE5634 /* SwiftColorWheelExamples */,
101 | C32C9B14207433F500EE5634 /* Products */,
102 | );
103 | sourceTree = "";
104 | };
105 | C32C9B14207433F500EE5634 /* Products */ = {
106 | isa = PBXGroup;
107 | children = (
108 | C32C9B13207433F500EE5634 /* SwiftColorWheel.framework */,
109 | C32C9B372074357F00EE5634 /* SwiftColorWheelExamples.app */,
110 | );
111 | name = Products;
112 | sourceTree = "";
113 | };
114 | C32C9B15207433F500EE5634 /* SwiftColorWheel */ = {
115 | isa = PBXGroup;
116 | children = (
117 | C32C9B2D2074356000EE5634 /* ColorWheel.swift */,
118 | C32C9B2F2074356100EE5634 /* ColorWheelLayer.swift */,
119 | C34870FF20752186007B57E3 /* DefaultWheelGestureHandler.swift */,
120 | C32C9B17207433F500EE5634 /* Info.plist */,
121 | C32C9B2E2074356000EE5634 /* RotatingColorWheel.swift */,
122 | C32C9B16207433F500EE5634 /* SwiftColorWheel.h */,
123 | );
124 | path = SwiftColorWheel;
125 | sourceTree = "";
126 | };
127 | C32C9B382074357F00EE5634 /* SwiftColorWheelExamples */ = {
128 | isa = PBXGroup;
129 | children = (
130 | C32C9B392074357F00EE5634 /* AppDelegate.swift */,
131 | C32C9B402074358100EE5634 /* Assets.xcassets */,
132 | C32C9B452074358100EE5634 /* Info.plist */,
133 | E1C4E94A2133B85400FFB951 /* launchimage.png */,
134 | C32C9B422074358100EE5634 /* LaunchScreen.storyboard */,
135 | C32C9B3D2074357F00EE5634 /* Main.storyboard */,
136 | C32C9B3B2074357F00EE5634 /* ViewController.swift */,
137 | );
138 | path = SwiftColorWheelExamples;
139 | sourceTree = "";
140 | };
141 | /* End PBXGroup section */
142 |
143 | /* Begin PBXHeadersBuildPhase section */
144 | C32C9B10207433F500EE5634 /* Headers */ = {
145 | isa = PBXHeadersBuildPhase;
146 | buildActionMask = 2147483647;
147 | files = (
148 | C32C9B24207433F500EE5634 /* SwiftColorWheel.h in Headers */,
149 | );
150 | runOnlyForDeploymentPostprocessing = 0;
151 | };
152 | /* End PBXHeadersBuildPhase section */
153 |
154 | /* Begin PBXNativeTarget section */
155 | C32C9B12207433F500EE5634 /* SwiftColorWheel */ = {
156 | isa = PBXNativeTarget;
157 | buildConfigurationList = C32C9B27207433F500EE5634 /* Build configuration list for PBXNativeTarget "SwiftColorWheel" */;
158 | buildPhases = (
159 | C32C9B0E207433F500EE5634 /* Sources */,
160 | C32C9B0F207433F500EE5634 /* Frameworks */,
161 | C32C9B10207433F500EE5634 /* Headers */,
162 | C32C9B11207433F500EE5634 /* Resources */,
163 | );
164 | buildRules = (
165 | );
166 | dependencies = (
167 | );
168 | name = SwiftColorWheel;
169 | productName = SwiftColorWheel;
170 | productReference = C32C9B13207433F500EE5634 /* SwiftColorWheel.framework */;
171 | productType = "com.apple.product-type.framework";
172 | };
173 | C32C9B362074357F00EE5634 /* SwiftColorWheelExamples */ = {
174 | isa = PBXNativeTarget;
175 | buildConfigurationList = C32C9B462074358100EE5634 /* Build configuration list for PBXNativeTarget "SwiftColorWheelExamples" */;
176 | buildPhases = (
177 | C32C9B332074357F00EE5634 /* Sources */,
178 | C32C9B342074357F00EE5634 /* Frameworks */,
179 | C32C9B352074357F00EE5634 /* Resources */,
180 | 42016CA3214B9954009CAA6C /* Copy Frameworks */,
181 | );
182 | buildRules = (
183 | );
184 | dependencies = (
185 | C32C9B4B2074371E00EE5634 /* PBXTargetDependency */,
186 | );
187 | name = SwiftColorWheelExamples;
188 | productName = SwiftColorWheelExamples;
189 | productReference = C32C9B372074357F00EE5634 /* SwiftColorWheelExamples.app */;
190 | productType = "com.apple.product-type.application";
191 | };
192 | /* End PBXNativeTarget section */
193 |
194 | /* Begin PBXProject section */
195 | C32C9B0A207433F500EE5634 /* Project object */ = {
196 | isa = PBXProject;
197 | attributes = {
198 | LastSwiftUpdateCheck = 0930;
199 | LastUpgradeCheck = 1240;
200 | ORGANIZATIONNAME = "Dennis Schmidt";
201 | TargetAttributes = {
202 | C32C9B12207433F500EE5634 = {
203 | CreatedOnToolsVersion = 9.3;
204 | LastSwiftMigration = 1020;
205 | };
206 | C32C9B362074357F00EE5634 = {
207 | CreatedOnToolsVersion = 9.3;
208 | LastSwiftMigration = 1020;
209 | };
210 | };
211 | };
212 | buildConfigurationList = C32C9B0D207433F500EE5634 /* Build configuration list for PBXProject "SwiftColorWheel" */;
213 | compatibilityVersion = "Xcode 9.3";
214 | developmentRegion = en;
215 | hasScannedForEncodings = 0;
216 | knownRegions = (
217 | en,
218 | Base,
219 | );
220 | mainGroup = C32C9B09207433F500EE5634;
221 | productRefGroup = C32C9B14207433F500EE5634 /* Products */;
222 | projectDirPath = "";
223 | projectRoot = "";
224 | targets = (
225 | C32C9B12207433F500EE5634 /* SwiftColorWheel */,
226 | C32C9B362074357F00EE5634 /* SwiftColorWheelExamples */,
227 | );
228 | };
229 | /* End PBXProject section */
230 |
231 | /* Begin PBXResourcesBuildPhase section */
232 | C32C9B11207433F500EE5634 /* Resources */ = {
233 | isa = PBXResourcesBuildPhase;
234 | buildActionMask = 2147483647;
235 | files = (
236 | );
237 | runOnlyForDeploymentPostprocessing = 0;
238 | };
239 | C32C9B352074357F00EE5634 /* Resources */ = {
240 | isa = PBXResourcesBuildPhase;
241 | buildActionMask = 2147483647;
242 | files = (
243 | E1C4E94B2133B85400FFB951 /* launchimage.png in Resources */,
244 | C32C9B442074358100EE5634 /* LaunchScreen.storyboard in Resources */,
245 | C32C9B412074358100EE5634 /* Assets.xcassets in Resources */,
246 | C32C9B3F2074357F00EE5634 /* Main.storyboard in Resources */,
247 | );
248 | runOnlyForDeploymentPostprocessing = 0;
249 | };
250 | /* End PBXResourcesBuildPhase section */
251 |
252 | /* Begin PBXSourcesBuildPhase section */
253 | C32C9B0E207433F500EE5634 /* Sources */ = {
254 | isa = PBXSourcesBuildPhase;
255 | buildActionMask = 2147483647;
256 | files = (
257 | C348710020752186007B57E3 /* DefaultWheelGestureHandler.swift in Sources */,
258 | C32C9B302074356100EE5634 /* ColorWheel.swift in Sources */,
259 | C32C9B312074356100EE5634 /* RotatingColorWheel.swift in Sources */,
260 | C32C9B322074356100EE5634 /* ColorWheelLayer.swift in Sources */,
261 | );
262 | runOnlyForDeploymentPostprocessing = 0;
263 | };
264 | C32C9B332074357F00EE5634 /* Sources */ = {
265 | isa = PBXSourcesBuildPhase;
266 | buildActionMask = 2147483647;
267 | files = (
268 | C32C9B3C2074357F00EE5634 /* ViewController.swift in Sources */,
269 | C32C9B3A2074357F00EE5634 /* AppDelegate.swift in Sources */,
270 | );
271 | runOnlyForDeploymentPostprocessing = 0;
272 | };
273 | /* End PBXSourcesBuildPhase section */
274 |
275 | /* Begin PBXTargetDependency section */
276 | C32C9B4B2074371E00EE5634 /* PBXTargetDependency */ = {
277 | isa = PBXTargetDependency;
278 | target = C32C9B12207433F500EE5634 /* SwiftColorWheel */;
279 | targetProxy = C32C9B4A2074371E00EE5634 /* PBXContainerItemProxy */;
280 | };
281 | /* End PBXTargetDependency section */
282 |
283 | /* Begin PBXVariantGroup section */
284 | C32C9B3D2074357F00EE5634 /* Main.storyboard */ = {
285 | isa = PBXVariantGroup;
286 | children = (
287 | C32C9B3E2074357F00EE5634 /* Base */,
288 | );
289 | name = Main.storyboard;
290 | sourceTree = "";
291 | };
292 | C32C9B422074358100EE5634 /* LaunchScreen.storyboard */ = {
293 | isa = PBXVariantGroup;
294 | children = (
295 | C32C9B432074358100EE5634 /* Base */,
296 | );
297 | name = LaunchScreen.storyboard;
298 | sourceTree = "";
299 | };
300 | /* End PBXVariantGroup section */
301 |
302 | /* Begin XCBuildConfiguration section */
303 | C32C9B25207433F500EE5634 /* Debug */ = {
304 | isa = XCBuildConfiguration;
305 | buildSettings = {
306 | ALWAYS_SEARCH_USER_PATHS = NO;
307 | CLANG_ANALYZER_NONNULL = YES;
308 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
309 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
310 | CLANG_CXX_LIBRARY = "libc++";
311 | CLANG_ENABLE_MODULES = YES;
312 | CLANG_ENABLE_OBJC_ARC = YES;
313 | CLANG_ENABLE_OBJC_WEAK = YES;
314 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
315 | CLANG_WARN_BOOL_CONVERSION = YES;
316 | CLANG_WARN_COMMA = YES;
317 | CLANG_WARN_CONSTANT_CONVERSION = YES;
318 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
319 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
320 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
321 | CLANG_WARN_EMPTY_BODY = YES;
322 | CLANG_WARN_ENUM_CONVERSION = YES;
323 | CLANG_WARN_INFINITE_RECURSION = YES;
324 | CLANG_WARN_INT_CONVERSION = YES;
325 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
326 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
327 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
328 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
329 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
330 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
331 | CLANG_WARN_STRICT_PROTOTYPES = YES;
332 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
333 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
334 | CLANG_WARN_UNREACHABLE_CODE = YES;
335 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
336 | CODE_SIGN_IDENTITY = "iPhone Developer";
337 | COPY_PHASE_STRIP = NO;
338 | CURRENT_PROJECT_VERSION = 1;
339 | DEBUG_INFORMATION_FORMAT = dwarf;
340 | ENABLE_STRICT_OBJC_MSGSEND = YES;
341 | ENABLE_TESTABILITY = YES;
342 | GCC_C_LANGUAGE_STANDARD = gnu11;
343 | GCC_DYNAMIC_NO_PIC = NO;
344 | GCC_NO_COMMON_BLOCKS = YES;
345 | GCC_OPTIMIZATION_LEVEL = 0;
346 | GCC_PREPROCESSOR_DEFINITIONS = (
347 | "DEBUG=1",
348 | "$(inherited)",
349 | );
350 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
351 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
352 | GCC_WARN_UNDECLARED_SELECTOR = YES;
353 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
354 | GCC_WARN_UNUSED_FUNCTION = YES;
355 | GCC_WARN_UNUSED_VARIABLE = YES;
356 | IPHONEOS_DEPLOYMENT_TARGET = 11.3;
357 | MTL_ENABLE_DEBUG_INFO = YES;
358 | ONLY_ACTIVE_ARCH = YES;
359 | SDKROOT = iphoneos;
360 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
361 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
362 | VERSIONING_SYSTEM = "apple-generic";
363 | VERSION_INFO_PREFIX = "";
364 | };
365 | name = Debug;
366 | };
367 | C32C9B26207433F500EE5634 /* Release */ = {
368 | isa = XCBuildConfiguration;
369 | buildSettings = {
370 | ALWAYS_SEARCH_USER_PATHS = NO;
371 | CLANG_ANALYZER_NONNULL = YES;
372 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
373 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
374 | CLANG_CXX_LIBRARY = "libc++";
375 | CLANG_ENABLE_MODULES = YES;
376 | CLANG_ENABLE_OBJC_ARC = YES;
377 | CLANG_ENABLE_OBJC_WEAK = YES;
378 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
379 | CLANG_WARN_BOOL_CONVERSION = YES;
380 | CLANG_WARN_COMMA = YES;
381 | CLANG_WARN_CONSTANT_CONVERSION = YES;
382 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
383 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
384 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
385 | CLANG_WARN_EMPTY_BODY = YES;
386 | CLANG_WARN_ENUM_CONVERSION = YES;
387 | CLANG_WARN_INFINITE_RECURSION = YES;
388 | CLANG_WARN_INT_CONVERSION = YES;
389 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
390 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
391 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
392 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
393 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
394 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
395 | CLANG_WARN_STRICT_PROTOTYPES = YES;
396 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
397 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
398 | CLANG_WARN_UNREACHABLE_CODE = YES;
399 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
400 | CODE_SIGN_IDENTITY = "iPhone Developer";
401 | COPY_PHASE_STRIP = NO;
402 | CURRENT_PROJECT_VERSION = 1;
403 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
404 | ENABLE_NS_ASSERTIONS = NO;
405 | ENABLE_STRICT_OBJC_MSGSEND = YES;
406 | GCC_C_LANGUAGE_STANDARD = gnu11;
407 | GCC_NO_COMMON_BLOCKS = YES;
408 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
409 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
410 | GCC_WARN_UNDECLARED_SELECTOR = YES;
411 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
412 | GCC_WARN_UNUSED_FUNCTION = YES;
413 | GCC_WARN_UNUSED_VARIABLE = YES;
414 | IPHONEOS_DEPLOYMENT_TARGET = 11.3;
415 | MTL_ENABLE_DEBUG_INFO = NO;
416 | SDKROOT = iphoneos;
417 | SWIFT_COMPILATION_MODE = wholemodule;
418 | SWIFT_OPTIMIZATION_LEVEL = "-O";
419 | VALIDATE_PRODUCT = YES;
420 | VERSIONING_SYSTEM = "apple-generic";
421 | VERSION_INFO_PREFIX = "";
422 | };
423 | name = Release;
424 | };
425 | C32C9B28207433F500EE5634 /* Debug */ = {
426 | isa = XCBuildConfiguration;
427 | buildSettings = {
428 | CLANG_ENABLE_MODULES = YES;
429 | CODE_SIGN_IDENTITY = "";
430 | CODE_SIGN_STYLE = Automatic;
431 | DEFINES_MODULE = YES;
432 | DYLIB_COMPATIBILITY_VERSION = 1;
433 | DYLIB_CURRENT_VERSION = 1;
434 | DYLIB_INSTALL_NAME_BASE = "@rpath";
435 | INFOPLIST_FILE = SwiftColorWheel/Info.plist;
436 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
437 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
438 | LD_RUNPATH_SEARCH_PATHS = (
439 | "$(inherited)",
440 | "@executable_path/Frameworks",
441 | "@loader_path/Frameworks",
442 | );
443 | MARKETING_VERSION = 1.5;
444 | PRODUCT_BUNDLE_IDENTIFIER = io.soundcard.SwiftColorWheel;
445 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
446 | SKIP_INSTALL = YES;
447 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
448 | SWIFT_VERSION = 5.0;
449 | TARGETED_DEVICE_FAMILY = "1,2";
450 | };
451 | name = Debug;
452 | };
453 | C32C9B29207433F500EE5634 /* Release */ = {
454 | isa = XCBuildConfiguration;
455 | buildSettings = {
456 | CLANG_ENABLE_MODULES = YES;
457 | CODE_SIGN_IDENTITY = "";
458 | CODE_SIGN_STYLE = Automatic;
459 | DEFINES_MODULE = YES;
460 | DYLIB_COMPATIBILITY_VERSION = 1;
461 | DYLIB_CURRENT_VERSION = 1;
462 | DYLIB_INSTALL_NAME_BASE = "@rpath";
463 | INFOPLIST_FILE = SwiftColorWheel/Info.plist;
464 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
465 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
466 | LD_RUNPATH_SEARCH_PATHS = (
467 | "$(inherited)",
468 | "@executable_path/Frameworks",
469 | "@loader_path/Frameworks",
470 | );
471 | MARKETING_VERSION = 1.5;
472 | PRODUCT_BUNDLE_IDENTIFIER = io.soundcard.SwiftColorWheel;
473 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
474 | SKIP_INSTALL = YES;
475 | SWIFT_VERSION = 5.0;
476 | TARGETED_DEVICE_FAMILY = "1,2";
477 | };
478 | name = Release;
479 | };
480 | C32C9B472074358100EE5634 /* Debug */ = {
481 | isa = XCBuildConfiguration;
482 | buildSettings = {
483 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
484 | CODE_SIGN_STYLE = Automatic;
485 | DEVELOPMENT_TEAM = AR4667766V;
486 | INFOPLIST_FILE = SwiftColorWheelExamples/Info.plist;
487 | LD_RUNPATH_SEARCH_PATHS = (
488 | "$(inherited)",
489 | "@executable_path/Frameworks",
490 | );
491 | PRODUCT_BUNDLE_IDENTIFIER = io.soundcard.SwiftColorWheelExamples;
492 | PRODUCT_NAME = "$(TARGET_NAME)";
493 | SWIFT_VERSION = 5.0;
494 | TARGETED_DEVICE_FAMILY = "1,2";
495 | };
496 | name = Debug;
497 | };
498 | C32C9B482074358100EE5634 /* Release */ = {
499 | isa = XCBuildConfiguration;
500 | buildSettings = {
501 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
502 | CODE_SIGN_STYLE = Automatic;
503 | DEVELOPMENT_TEAM = AR4667766V;
504 | INFOPLIST_FILE = SwiftColorWheelExamples/Info.plist;
505 | LD_RUNPATH_SEARCH_PATHS = (
506 | "$(inherited)",
507 | "@executable_path/Frameworks",
508 | );
509 | PRODUCT_BUNDLE_IDENTIFIER = io.soundcard.SwiftColorWheelExamples;
510 | PRODUCT_NAME = "$(TARGET_NAME)";
511 | SWIFT_VERSION = 5.0;
512 | TARGETED_DEVICE_FAMILY = "1,2";
513 | };
514 | name = Release;
515 | };
516 | /* End XCBuildConfiguration section */
517 |
518 | /* Begin XCConfigurationList section */
519 | C32C9B0D207433F500EE5634 /* Build configuration list for PBXProject "SwiftColorWheel" */ = {
520 | isa = XCConfigurationList;
521 | buildConfigurations = (
522 | C32C9B25207433F500EE5634 /* Debug */,
523 | C32C9B26207433F500EE5634 /* Release */,
524 | );
525 | defaultConfigurationIsVisible = 0;
526 | defaultConfigurationName = Release;
527 | };
528 | C32C9B27207433F500EE5634 /* Build configuration list for PBXNativeTarget "SwiftColorWheel" */ = {
529 | isa = XCConfigurationList;
530 | buildConfigurations = (
531 | C32C9B28207433F500EE5634 /* Debug */,
532 | C32C9B29207433F500EE5634 /* Release */,
533 | );
534 | defaultConfigurationIsVisible = 0;
535 | defaultConfigurationName = Release;
536 | };
537 | C32C9B462074358100EE5634 /* Build configuration list for PBXNativeTarget "SwiftColorWheelExamples" */ = {
538 | isa = XCConfigurationList;
539 | buildConfigurations = (
540 | C32C9B472074358100EE5634 /* Debug */,
541 | C32C9B482074358100EE5634 /* Release */,
542 | );
543 | defaultConfigurationIsVisible = 0;
544 | defaultConfigurationName = Release;
545 | };
546 | /* End XCConfigurationList section */
547 | };
548 | rootObject = C32C9B0A207433F500EE5634 /* Project object */;
549 | }
550 |
--------------------------------------------------------------------------------
/SwiftColorWheel.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SwiftColorWheel.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SwiftColorWheel.xcodeproj/xcshareddata/xcschemes/SwiftColorWheel.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
42 |
48 |
49 |
50 |
51 |
52 |
62 |
63 |
69 |
70 |
71 |
72 |
78 |
79 |
85 |
86 |
87 |
88 |
90 |
91 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/SwiftColorWheel.xcodeproj/xcshareddata/xcschemes/SwiftColorWheelExamples.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/SwiftColorWheel/ColorWheel.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | /**
4 | Delegate to the ColorWheel.
5 | */
6 | public protocol ColorWheelDelegate: class {
7 | /**
8 | If a delegate is set, this method is invoked with the color closed to the
9 | user's tap location.
10 | */
11 | func didSelect(color: UIColor)
12 | }
13 |
14 | /**
15 | Basic color wheel picker.
16 | This class draws a round, wheel-like color picker which can be tapped by the user.
17 | The interpolated color closed to the tap location is returned to its `ColorWheelDelegate`.
18 | */
19 | public class ColorWheel: UIView {
20 | /// Delegate to inform when color is picked.
21 | public weak var delegate: ColorWheelDelegate?
22 |
23 | /// Overall color brightness. Animatable.
24 | @objc public dynamic var brightness: CGFloat { didSet { wheelLayer.brightness = brightness } }
25 |
26 | /// Extra padding in points to the view border.
27 | public var padding: CGFloat = 12.0 { didSet { setNeedsDisplay() } }
28 |
29 | /// Radius in point of the central color circle (for black & white shades).
30 | public var centerRadius: CGFloat = 4.0 { didSet { setNeedsDisplay() } }
31 |
32 | /// Smallest circle radius in point.
33 | public var minCircleRadius: CGFloat = 1.0 { didSet { setNeedsDisplay() } }
34 |
35 | /// Largest circle radius in point.
36 | public var maxCircleRadius: CGFloat = 6.0 { didSet { setNeedsDisplay() } }
37 |
38 | /// Padding between circles in point.
39 | public var innerPadding: CGFloat = 2 { didSet { setNeedsDisplay() } }
40 |
41 | /// Stroke color highlighting currently selected color. Set nil to disable highlighting.
42 | public var highlightStrokeColor: UIColor? = UIColor.white { didSet { setNeedsDisplay() } }
43 |
44 | /// Outer Radius of the ColorWheel in point.
45 | public var radius: CGFloat {
46 | return wheelLayer.radius(in: bounds)
47 | }
48 |
49 | /**
50 | Degree by which each row of circles is shifted.
51 | A value of 0 results in a straight layout of the inner circles.
52 | A value other than 0 results in a slightly shifted, fractal-ish / flower-ish look.
53 | */
54 | public var shiftDegree: CGFloat = 40 { didSet { setNeedsDisplay() } }
55 |
56 | /// Overall density of inner circles.
57 | public var density: CGFloat = 0.8 { didSet { setNeedsDisplay() } }
58 |
59 | private let normalizedRadius: CGFloat = 1.0
60 |
61 | fileprivate var wheelLayer: ColorWheelLayer! {
62 | return layer as? ColorWheelLayer
63 | }
64 |
65 | private var tapRecognizer: UITapGestureRecognizer!
66 |
67 | public required init?(coder aDecoder: NSCoder) {
68 | brightness = 1.0
69 | super.init(coder: aDecoder)
70 |
71 | layer.contentsScale = UIScreen.main.scale
72 | prepareTapRecognizer()
73 | contentMode = .redraw
74 | }
75 |
76 | public override init(frame: CGRect) {
77 | brightness = 1.0
78 | super.init(frame: frame)
79 |
80 | layer.contentsScale = UIScreen.main.scale
81 | prepareTapRecognizer()
82 | contentMode = .redraw
83 | }
84 |
85 | override public class var layerClass: AnyClass {
86 | return ColorWheelLayer.self
87 | }
88 |
89 | // taken from: https://stackoverflow.com/questions/14192816/create-a-custom-animatable-property/44961463#44961463
90 | // backgroundColor is simply a "placeholder" to get the UIView.animate() properties
91 | override public func action(for layer: CALayer, forKey event: String) -> CAAction? {
92 | if event == #keyPath(ColorWheelLayer.brightness),
93 | let action = action(for: layer, forKey: #keyPath(backgroundColor)) as? CAAnimation {
94 |
95 | let animation = CABasicAnimation()
96 | animation.keyPath = #keyPath(ColorWheelLayer.brightness)
97 | animation.fromValue = wheelLayer.brightness
98 | animation.toValue = brightness
99 | animation.beginTime = action.beginTime
100 | animation.duration = action.duration
101 | animation.speed = action.speed
102 | animation.timeOffset = action.timeOffset
103 | animation.repeatCount = action.repeatCount
104 | animation.repeatDuration = action.repeatDuration
105 | animation.autoreverses = action.autoreverses
106 | animation.fillMode = action.fillMode
107 | animation.timingFunction = action.timingFunction
108 | animation.delegate = action.delegate
109 | self.layer.add(animation, forKey: #keyPath(ColorWheelLayer.brightness))
110 | }
111 | return super.action(for: layer, forKey: event)
112 | }
113 |
114 | /**
115 | Distance from given point to center, normalized to the ColorWheel radius.
116 | 0: directly on center
117 | 1: directly on radius
118 | `to` is assumed to be in ColorWheel coordinates.
119 | */
120 | public func normalizedDistanceFromCenter(to touchPoint: CGPoint) -> CGFloat {
121 | let distance = sqrt(pow(touchPoint.x - wheelCenter.x, 2) + pow(touchPoint.y - wheelCenter.y, 2))
122 | return distance / radius
123 | }
124 |
125 | @objc func didRegisterTap(recognizer: UITapGestureRecognizer) {
126 | let touchPoint = recognizer.location(in: self)
127 | let distance = normalizedDistanceFromCenter(to: touchPoint)
128 | guard distance <= normalizedRadius else { return }
129 |
130 | let angle = adjustedAngleTo(center: wheelCenter, pointOnCircle: touchPoint, distance: distance)
131 | let tappedColor = wheelLayer.color(at: angle, shiftedBy: shiftDegree, distance: distance)
132 | wheelLayer.lastTouchPoint = touchPoint
133 | delegate?.didSelect(color: tappedColor)
134 | }
135 |
136 | func removeHighlightCircle() {
137 | wheelLayer.lastTouchPoint = nil
138 | }
139 |
140 | func angleTo(center: CGPoint, pointOnCircle: CGPoint) -> CGFloat {
141 | let originX = pointOnCircle.x - center.x
142 | let originY = pointOnCircle.y - center.y
143 | return atan2(originY, originX)
144 | }
145 |
146 | func adjustedAngleTo(center: CGPoint, pointOnCircle: CGPoint, distance: CGFloat) -> CGFloat {
147 | var radians = angleTo(center: center, pointOnCircle: pointOnCircle)
148 | while radians < 0 { radians += CGFloat(2 * Double.pi) }
149 | let counterClockwise = 2 * .pi - (radians + (shiftDegree * distance) / 180 * .pi)
150 | return counterClockwise
151 | }
152 |
153 | var wheelCenter: CGPoint {
154 | return CGPoint(x: bounds.size.width / 2, y: bounds.size.height / 2)
155 | }
156 |
157 | func prepareTapRecognizer() {
158 | tapRecognizer = UITapGestureRecognizer()
159 | tapRecognizer.numberOfTouchesRequired = 1
160 | addGestureRecognizer(tapRecognizer)
161 | tapRecognizer.addTarget(self, action: #selector(didRegisterTap(recognizer:)))
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/SwiftColorWheel/ColorWheelLayer.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | class ColorWheelLayer: CALayer {
4 | @NSManaged var brightness: CGFloat
5 |
6 | var lastTouchPoint: CGPoint? {
7 | didSet {
8 | setNeedsDisplay()
9 | }
10 | }
11 |
12 | // swiftlint:disable force_cast
13 | private var padding: CGFloat { return (delegate as! ColorWheel).padding }
14 | private var centerRadius: CGFloat { return (delegate as! ColorWheel).centerRadius }
15 | private var minCircleRadius: CGFloat { return (delegate as! ColorWheel).minCircleRadius }
16 | private var maxCircleRadius: CGFloat { return (delegate as! ColorWheel).maxCircleRadius }
17 | private var innerPadding: CGFloat { return (delegate as! ColorWheel).innerPadding }
18 | private var shiftDegree: CGFloat { return (delegate as! ColorWheel).shiftDegree }
19 | private var density: CGFloat { return (delegate as! ColorWheel).density }
20 | private var highlightStrokeColor: UIColor? { return (delegate as! ColorWheel).highlightStrokeColor }
21 | // swiftlint:enable force_cast
22 |
23 | private let defaultBrightness: CGFloat = 1.0
24 |
25 | override init(layer: Any) {
26 | super.init(layer: layer)
27 | brightness = (layer as? ColorWheelLayer)?.brightness ?? 1.0
28 | }
29 |
30 | override init() {
31 | super.init()
32 | brightness = defaultBrightness
33 | }
34 |
35 | required init(coder decoder: NSCoder) {
36 | super.init(coder: decoder)!
37 | }
38 |
39 | override class func needsDisplay(forKey key: String) -> Bool {
40 | if key == #keyPath(brightness) {
41 | return true
42 | }
43 | return super.needsDisplay(forKey: key)
44 | }
45 |
46 | override func draw(in context: CGContext) {
47 | super.draw(in: context)
48 | UIGraphicsPushContext(context)
49 |
50 | let outerRadius = radius(in: bounds)
51 | var innerRadius = outerRadius
52 | var prevDotRadius = dotRadius(distance: 1)
53 | var currentDotRadius: CGFloat
54 | let center = CGPoint(x: bounds.size.width / 2, y: bounds.size.height / 2)
55 |
56 | repeat {
57 | let distance = innerRadius / outerRadius
58 | currentDotRadius = dotRadius(distance: distance)
59 |
60 | arcPositions(dotRadius: currentDotRadius, on: innerRadius).forEach { rad in
61 | drawPickerCircle(in: context, around: center, on: outerRadius, rad: rad, distance: distance)
62 | }
63 | innerRadius -= (prevDotRadius + 2 * currentDotRadius + innerPadding)
64 | prevDotRadius = currentDotRadius
65 | } while innerRadius > 2 * centerRadius + currentDotRadius
66 |
67 | drawPickerCircle(in: context, around: center, on: outerRadius, rad: 0, distance: 0)
68 | drawHighlightCircle(in: context, around: center, on: outerRadius)
69 |
70 | UIGraphicsPopContext()
71 | }
72 |
73 | func radius(in rect: CGRect) -> CGFloat {
74 | return min(rect.size.width, rect.size.height) / 2 - padding
75 | }
76 |
77 | func color(at rad: CGFloat, shiftedBy shiftDegree: CGFloat, distance: CGFloat) -> UIColor {
78 | let shiftedRad = rad + (shiftDegree * distance) / 180 * .pi
79 | return UIColor(hue: shiftedRad / (2 * .pi), saturation: distance, brightness: brightness, alpha: 1)
80 | }
81 | }
82 |
83 | fileprivate extension ColorWheelLayer {
84 | func arcPositions(dotRadius: CGFloat, on radius: CGFloat) -> [CGFloat] {
85 | let circlesFitting = (2 * dotRadius) > radius
86 | ? 1
87 | : max(1, Int((density * .pi / (asin((2 * dotRadius) / radius)))))
88 | let stepSize = 2 * .pi / CGFloat(circlesFitting - 1)
89 | return (0.. CGRect {
127 | CGRect(x: center.x - radius, y: center.y - radius, width: radius * modifier, height: radius * modifier)
128 | }
129 |
130 | func dotRadius(distance: CGFloat) -> CGFloat {
131 | guard distance > 0 else { return centerRadius }
132 | return max(minCircleRadius, maxCircleRadius * distance)
133 | }
134 |
135 | func position(around center: CGPoint, shiftedBy shiftDegree: CGFloat, on radius: CGFloat, rad: CGFloat, distance: CGFloat) -> CGPoint {
136 | let shiftedRad = rad + (shiftDegree * distance) / 180 * .pi
137 | let x = center.x + (radius - padding) * distance * cos(-shiftedRad)
138 | let y = center.y + (radius - padding) * distance * sin(-shiftedRad)
139 | return CGPoint(x: x, y: y)
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/SwiftColorWheel/DefaultWheelGestureHandler.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import UIKit
3 |
4 | class DefaultWheelGestureHandler: NSObject, UIGestureRecognizerDelegate {
5 | weak var colorWheel: RotatingColorWheel?
6 |
7 | func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
8 | guard let colorWheel = colorWheel else { return false }
9 |
10 | switch gestureRecognizer {
11 | case colorWheel.panRecognizer: return handlePanGesture(colorWheel.panRecognizer)
12 | case colorWheel.rotateRecognizer: return handleRotateGesture(colorWheel.rotateRecognizer)
13 | default: return true // any other recognizer should deal with animation etc. itself
14 | }
15 | }
16 |
17 | private func handlePanGesture(_ gestureRecognizer: UIPanGestureRecognizer) -> Bool {
18 | guard let colorWheel = colorWheel else { return true }
19 |
20 | colorWheel.removeHighlightCircle()
21 |
22 | // since the view is rotated, the coordinates are also "rotated"
23 | let rotatedTouchPoint = gestureRecognizer.location(in: colorWheel)
24 | let distance = colorWheel.normalizedDistanceFromCenter(to: rotatedTouchPoint)
25 | let isWithinRadius = distance <= 1.0
26 |
27 | return isWithinRadius && !colorWheel.isAnimating
28 | }
29 |
30 | private func handleRotateGesture(_ gestureRecognizer: UIRotationGestureRecognizer) -> Bool {
31 | guard let colorWheel = colorWheel else { return true }
32 |
33 | colorWheel.removeHighlightCircle()
34 |
35 | // since the view is rotated, the coordinates are also "rotated"
36 | let rotatedTouchPointA = gestureRecognizer.location(ofTouch: 0, in: colorWheel)
37 | let rotatedTouchPointB = gestureRecognizer.location(ofTouch: 1, in: colorWheel)
38 | let distanceA = colorWheel.normalizedDistanceFromCenter(to: rotatedTouchPointA)
39 | let distanceB = colorWheel.normalizedDistanceFromCenter(to: rotatedTouchPointB)
40 | let areWithinRadius = distanceA <= 1.0 && distanceB <= 1.0
41 |
42 | return areWithinRadius && !colorWheel.isAnimating
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/SwiftColorWheel/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | $(MARKETING_VERSION)
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSPrincipalClass
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/SwiftColorWheel/RotatingColorWheel.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | enum RotationDirection: CGFloat {
4 | case none = 0
5 | case clockwise = 1
6 | case counterClockwise = -1
7 | }
8 |
9 | /**
10 | Rotatable color wheel picker.
11 | This is a subclass of `ColorWheel`. It adds two `UIGestureRecognizeras` to itself.
12 | Those allow one-finger and two-finger circular rotation to adjust the overall
13 | brightness of the colors.
14 | */
15 | public class RotatingColorWheel: ColorWheel, CAAnimationDelegate {
16 | public private(set) var panRecognizer: UIPanGestureRecognizer!
17 | public private(set) var rotateRecognizer: UIRotationGestureRecognizer!
18 |
19 | private let defaultGestureHandler: DefaultWheelGestureHandler
20 |
21 | private var rotationArch: CGFloat = 2 * .pi
22 | private var lastDirection: RotationDirection = .none
23 | private var lastAngle: CGFloat = 2 * .pi
24 | private var angleDeltas: [CGFloat] = [0, 0, 0]
25 | private var timeDeltas: [TimeInterval] = [0, 0, 0]
26 | private let maxRotationSpeed: CGFloat = 0.7
27 | private let minimumSpeedThreshold: CGFloat = 0.06
28 | private let rotationAnimationDuration = 0.5
29 |
30 | public required init?(coder aDecoder: NSCoder) {
31 | defaultGestureHandler = DefaultWheelGestureHandler()
32 | super.init(coder: aDecoder)
33 | prepareRotationRecognizers()
34 | }
35 |
36 | public override init(frame: CGRect) {
37 | defaultGestureHandler = DefaultWheelGestureHandler()
38 | super.init(frame: frame)
39 | prepareRotationRecognizers()
40 | }
41 |
42 | public var isAnimating: Bool {
43 | return layer.animationKeys()?.isEmpty ?? false
44 | }
45 |
46 | @objc func didRotate(recognizer: UIRotationGestureRecognizer) {
47 | let newRotationArch = rotationArch + recognizer.rotation
48 | if recognizer.state == .changed {
49 | rotate(to: dampened(rotation: newRotationArch))
50 | } else if recognizer.state == .ended {
51 | rotationArch = newRotationArch
52 | continueAnimationMotionOrSnapBackIfOutOfRange(velocity: recognizer.velocity)
53 | } else if recognizer.state == .cancelled {
54 | continueAnimationMotionOrSnapBackIfOutOfRange(velocity: recognizer.velocity)
55 | }
56 | }
57 |
58 | func angleDelta(_ newAngle: CGFloat, _ oldAngle: CGFloat) -> CGFloat {
59 | return abs((abs(newAngle) - abs(oldAngle))) * movementDirection(newAngle, oldAngle).rawValue
60 | }
61 |
62 | func movementDirection(_ newAngle: CGFloat, _ oldAngle: CGFloat) -> RotationDirection {
63 | if newAngle < 0 && oldAngle > 0 && abs(newAngle) > .pi / 2 {
64 | return .clockwise
65 | } else if newAngle > 0 && oldAngle < 0 && abs(newAngle) > .pi / 2 {
66 | return .counterClockwise
67 | } else if newAngle > oldAngle {
68 | return .clockwise
69 | } else {
70 | return .counterClockwise
71 | }
72 | }
73 |
74 | func dampened(rotation: CGFloat) -> CGFloat {
75 | if rotation < 0 {
76 | let minValue: CGFloat = -(.pi)
77 | let undampenedDelta = max(minValue, rotation)
78 | let progress = abs(undampenedDelta / .pi)
79 | let dampenedProgress = sin(sqrt(progress) * (.pi / 2))
80 | return dampenedProgress * (-(.pi / 8))
81 | } else if rotation > 2 * .pi {
82 | let maxValue: CGFloat = 2 * .pi + .pi
83 | let undampenedDelta = min(maxValue, rotation) - 2 * .pi
84 | let progress = undampenedDelta / .pi
85 | let dampenedProgress = sin(sqrt(progress) * (.pi / 2))
86 | return 2 * .pi + dampenedProgress * (.pi / 8)
87 | }
88 | return rotation
89 | }
90 |
91 | @objc func didPan(recognizer: UIPanGestureRecognizer) {
92 | let touchPoint = recognizer.location(in: superview!)
93 | let center = convert(wheelCenter, to: superview!)
94 | let angle = angleTo(center: center, pointOnCircle: touchPoint)
95 |
96 | let newRotationArch = rotationArch + angleDelta(angle, lastAngle)
97 | trackAngleTravelled(delta: angleDelta(angle, lastAngle))
98 | if recognizer.state == .began {
99 | angleDeltas = [0, 0, 0]
100 | timeDeltas = [0, 0, 0]
101 | lastAngle = angle
102 | } else if recognizer.state == .changed {
103 | rotate(to: dampened(rotation: newRotationArch))
104 | lastDirection = movementDirection(angle, lastAngle)
105 | lastAngle = angle
106 | rotationArch = newRotationArch
107 | } else if recognizer.state == .ended {
108 | rotationArch = newRotationArch
109 | continueAnimationMotionOrSnapBackIfOutOfRange(velocity: radialSpeed(direction: lastDirection))
110 | } else if recognizer.state == .cancelled {
111 | continueAnimationMotionOrSnapBackIfOutOfRange(velocity: radialSpeed(direction: lastDirection))
112 | }
113 | }
114 |
115 | func trackAngleTravelled(delta: CGFloat) {
116 | angleDeltas.append(abs(delta))
117 | timeDeltas.append(Date().timeIntervalSince1970)
118 | angleDeltas.remove(at: 0)
119 | timeDeltas.remove(at: 0)
120 | }
121 |
122 | func radialSpeed(direction: RotationDirection) -> CGFloat {
123 | let distance: CGFloat = abs(angleDeltas.reduce(0, +))
124 | let timeDelta: CGFloat = CGFloat(timeDeltas.last! - timeDeltas.first!) * 10
125 | return min(maxRotationSpeed, distance / timeDelta) * direction.rawValue
126 | }
127 |
128 | func isOutOfSpinRange() -> Bool {
129 | return rotationArch < 0 || rotationArch > 2 * .pi
130 | }
131 |
132 | func continueAnimationMotionOrSnapBackIfOutOfRange(velocity: CGFloat) {
133 | if isOutOfSpinRange() {
134 | animateSpinBackMotion()
135 | } else if abs(velocity) > minimumSpeedThreshold {
136 | let deceleration: CGFloat = 0.1 // rad/s^2
137 | var distance = pow(velocity, 2) / (2 * deceleration)
138 | while distance >= .pi { distance -= .pi / 8 }
139 | let targetRotationArch = min(2 * .pi, max(0, rotationArch + distance * (velocity > 0 ? 1 : -1)))
140 | let targetRotationTransform = CATransform3DRotate(CATransform3DIdentity, targetRotationArch, 0, 0, 1)
141 | let targetBrightness = targetRotationArch / (2 * .pi)
142 |
143 | UIView.animate(withDuration: rotationAnimationDuration, delay: 0, options: .curveEaseOut, animations: {
144 | self.brightness = targetBrightness
145 | self.layer.transform = targetRotationTransform
146 | })
147 |
148 | brightness = targetBrightness
149 | rotationArch = targetRotationArch
150 | }
151 | }
152 |
153 | private func prepareRotationRecognizers() {
154 | defaultGestureHandler.colorWheel = self
155 | rotateRecognizer = UIRotationGestureRecognizer(target: self, action: #selector(didRotate(recognizer:)))
156 | panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(didPan(recognizer:)))
157 | rotateRecognizer.delegate = defaultGestureHandler
158 | panRecognizer.delegate = defaultGestureHandler
159 | addGestureRecognizer(rotateRecognizer)
160 | addGestureRecognizer(panRecognizer)
161 | }
162 | }
163 |
164 | // MARK: - CAAnimationDelegate
165 |
166 | extension RotatingColorWheel {
167 | public func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
168 | if isOutOfSpinRange() {
169 | animateSpinBackMotion()
170 | }
171 | }
172 | }
173 |
174 | // MARK: - Private
175 |
176 | fileprivate extension RotatingColorWheel {
177 | func animateSpinBackMotion() {
178 | let targetRotationArch: CGFloat = rotationArch < 0 ? 0 : 2 * .pi
179 | let spring = CASpringAnimation(keyPath: "transform")
180 | spring.damping = 20
181 | spring.stiffness = 1000
182 | spring.fromValue = NSValue(caTransform3D: layer.transform)
183 | // probably CATransform3DIdentity is enough here, but does it result in the same layer.transform?
184 | spring.toValue = NSValue(caTransform3D: CATransform3DRotate(CATransform3DIdentity, targetRotationArch, 0, 0, 1))
185 | spring.duration = spring.settlingDuration
186 | layer.transform = CATransform3DRotate(CATransform3DIdentity, targetRotationArch, 0, 0, 1)
187 | layer.add(spring, forKey: "transformAnimation")
188 | rotationArch = targetRotationArch
189 | brightness = targetRotationArch / (2 * .pi)
190 | }
191 |
192 | func rotate(to radians: CGFloat) {
193 | transform = CGAffineTransform(rotationAngle: radians)
194 | let mappedBrightness = radians / (2 * .pi)
195 | guard mappedBrightness >= 0 && mappedBrightness <= 1.0 else { return }
196 | brightness = mappedBrightness
197 | }
198 | }
199 |
--------------------------------------------------------------------------------
/SwiftColorWheel/SwiftColorWheel.h:
--------------------------------------------------------------------------------
1 | //
2 | // SwiftColorWheel.h
3 | // SwiftColorWheel
4 | //
5 | // Created by Dennis Schmidt on 03.04.18.
6 | // Copyright © 2018 Dennis Schmidt. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for SwiftColorWheel.
12 | FOUNDATION_EXPORT double SwiftColorWheelVersionNumber;
13 |
14 | //! Project version string for SwiftColorWheel.
15 | FOUNDATION_EXPORT const unsigned char SwiftColorWheelVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // SwiftColorWheelExamples
4 | //
5 | // Created by Dennis Schmidt on 03.04.18.
6 | // Copyright © 2018 Dennis Schmidt. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@2x.png",
19 | "scale" : "2x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@3x.png",
25 | "scale" : "3x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-40x40@2x.png",
31 | "scale" : "2x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@3x.png",
37 | "scale" : "3x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-60x60@2x.png",
43 | "scale" : "2x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@3x.png",
49 | "scale" : "3x"
50 | },
51 | {
52 | "size" : "20x20",
53 | "idiom" : "ipad",
54 | "filename" : "Icon-App-20x20@1x.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@2x-1.png",
61 | "scale" : "2x"
62 | },
63 | {
64 | "size" : "29x29",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-29x29@1x.png",
67 | "scale" : "1x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@2x-1.png",
73 | "scale" : "2x"
74 | },
75 | {
76 | "size" : "40x40",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-40x40@1x.png",
79 | "scale" : "1x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@2x-1.png",
85 | "scale" : "2x"
86 | },
87 | {
88 | "size" : "76x76",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-76x76@1x.png",
91 | "scale" : "1x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@2x.png",
97 | "scale" : "2x"
98 | },
99 | {
100 | "size" : "83.5x83.5",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-83.5x83.5@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "1024x1024",
107 | "idiom" : "ios-marketing",
108 | "filename" : "icon.png",
109 | "scale" : "1x"
110 | }
111 | ],
112 | "info" : {
113 | "version" : 1,
114 | "author" : "xcode"
115 | }
116 | }
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x-1.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x-1.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x-1.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/Assets.xcassets/AppIcon.appiconset/icon.png
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 2
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // SwiftrotatingWheelExamples
4 | //
5 | // Created by Dennis Schmidt on 03.04.18.
6 | // Copyright © 2018 Dennis Schmidt. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import SwiftColorWheel
11 |
12 | class ViewController: UIViewController {
13 | @IBOutlet weak var standardWheel: ColorWheel!
14 | @IBOutlet weak var rotatingWheel: RotatingColorWheel!
15 |
16 | override func viewDidLoad() {
17 | super.viewDidLoad()
18 |
19 | standardWheel.delegate = self
20 | rotatingWheel.delegate = self
21 |
22 | standardWheel.padding = 13.0
23 | standardWheel.centerRadius = 5.0
24 | standardWheel.minCircleRadius = 1.0
25 | standardWheel.maxCircleRadius = 5.0
26 | standardWheel.innerPadding = 3
27 | standardWheel.shiftDegree = 0
28 | standardWheel.density = 1.0
29 | standardWheel.highlightStrokeColor = nil
30 | }
31 | }
32 |
33 | extension ViewController: ColorWheelDelegate {
34 | func didSelect(color: UIColor) {
35 | view.backgroundColor = color
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/SwiftColorWheelExamples/launchimage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/SwiftColorWheelExamples/launchimage.png
--------------------------------------------------------------------------------
/appstore.svg:
--------------------------------------------------------------------------------
1 |
2 | Download_on_the_App_Store_Badge_US-UK_RGB_blk_4SVG_092917
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/rotatingcolorwheel.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/rotatingcolorwheel.gif
--------------------------------------------------------------------------------
/screenshot_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/screenshot_1.png
--------------------------------------------------------------------------------
/screenshot_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/screenshot_2.png
--------------------------------------------------------------------------------
/screenshot_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/screenshot_3.png
--------------------------------------------------------------------------------
/screenshot_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmrschmidt/SwiftColorWheel/482e004e85009c9d40454035a324834740efb0f6/screenshot_4.png
--------------------------------------------------------------------------------