on master help sign in
34 files changed+1173−48
since splitsnapshots
unifiedsplit
.swift-version+1−1 .travis.yml+49 Example/Example.xcodeproj/project.pbxproj+361 Example/Example/AppDelegate.swift+46 Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json+98 Example/Example/Assets.xcassets/Contents.json+6 Example/Example/Base.lproj/LaunchScreen.storyboard+25 Example/Example/Base.lproj/Main.storyboard+206 Example/Example/Info.plist+45 Example/Example/ViewController.swift+84 HueKit.podspec+14 HueKit.xcodeproj/project.pbxproj+14−5 HueKit.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme+80 HueKit.xcworkspace/contents.xcworkspacedata+10 HueKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist+8 HueKit/Info.plist+1−1 HueKit/Model/HSV.swift+1−1 HueKit/Model/RGB.swift+1−1 HueKit/View/ColorBarPicker.swift+12−12 HueKit/View/ColorBarView.swift+2−2 HueKit/View/ColorIndicatorView.swift+5−4 HueKit/View/ColorSquarePicker.swift+12−8 HueKit/View/ColorSquareView.swift+4−4 HueKit/View/SourceColorView.swift+8−8 LICENSE+1−1 README.md+79 readme-resources/components/ColorBarPicker.png readme-resources/components/ColorBarView.png readme-resources/components/ColorIndicatorView.png readme-resources/components/ColorSquarePicker.png readme-resources/components/ColorSquareView.png readme-resources/components/SourceColorView.png readme-resources/example.gif readme-resources/hero@2x.png
.swift-version+1−1
@@ -1 +1 @@
1−4.0
1+4.1
.travis.ymlnew file+49
@@ -0,0 +1,49 @@
1+language: objective-c
2+osx_image: xcode9.3
3+branches:
4+ only:
5+ - master
6+env:
7+ global:
8+ - LC_CTYPE=en_US.UTF-8
9+ - LANG=en_US.UTF-8
10+ - WORKSPACE=HueKit.xcworkspace
11+ - IOS_FRAMEWORK_SCHEME="HueKit"
12+ - EXAMPLE_SCHEME="Example"
13+ matrix:
14+
15+ - DESTINATION="OS=10.0,name=iPhone 7" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="NO" BUILD_EXAMPLE="YES" CODE_COV="NO"
16+ - DESTINATION="OS=11.3,name=iPad Pro (9.7-inch)" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="NO" BUILD_EXAMPLE="YES" CODE_COV="NO"
17+
18+script:
19+ - set -o pipefail
20+ - xcodebuild -version
21+ - xcodebuild -showsdks
22+
23+ # Build Framework in Debug and Run Tests if specified
24+ - if [ $RUN_TESTS == "YES" ]; then
25+ travis_retry xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty;
26+ else
27+ travis_retry xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty;
28+ fi
29+
30+ # Build Framework in Release and Run Tests if specified
31+ - if [ $RUN_TESTS == "YES" ]; then
32+ travis_retry xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty;
33+ else
34+ travis_retry xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty;
35+ fi
36+
37+ # Build Example in Debug if specified
38+ - if [ $BUILD_EXAMPLE == "YES" ]; then
39+ travis_retry xcodebuild -workspace "$WORKSPACE" -scheme "$EXAMPLE_SCHEME" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty;
40+ fi
41+
42+ # Build and report code coverage if specified
43+ - if [ $CODE_COV == "YES" ]; then
44+ xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=YES ENABLE_TESTABILITY=YES -enableCodeCoverage YES test;
45+ fi
46+
47+after_success:
48+ - bash <(curl -s https://codecov.io/bash)
49+
Example/Example.xcodeproj/project.pbxprojnew file+361
@@ -0,0 +1,361 @@
1+// !$*UTF8*$!
2+{
3+ archiveVersion = 1;
4+ classes = {
5+ };
6+ objectVersion = 50;
7+ objects = {
8+
9+/* Begin PBXBuildFile section */
10+ BEB7754C207267E400201EBB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEB7754B207267E400201EBB /* AppDelegate.swift */; };
11+ BEB7754E207267E400201EBB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEB7754D207267E400201EBB /* ViewController.swift */; };
12+ BEB77551207267E400201EBB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BEB7754F207267E400201EBB /* Main.storyboard */; };
13+ BEB77553207267E500201EBB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BEB77552207267E500201EBB /* Assets.xcassets */; };
14+ BEB77556207267E500201EBB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BEB77554207267E500201EBB /* LaunchScreen.storyboard */; };
15+ BEB7755E207267F800201EBB /* HueKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEB7755D207267F800201EBB /* HueKit.framework */; };
16+ BEB7755F207267F800201EBB /* HueKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BEB7755D207267F800201EBB /* HueKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
17+/* End PBXBuildFile section */
18+
19+/* Begin PBXCopyFilesBuildPhase section */
20+ BEB77560207267F800201EBB /* Embed Frameworks */ = {
21+ isa = PBXCopyFilesBuildPhase;
22+ buildActionMask = 2147483647;
23+ dstPath = "";
24+ dstSubfolderSpec = 10;
25+ files = (
26+ BEB7755F207267F800201EBB /* HueKit.framework in Embed Frameworks */,
27+ );
28+ name = "Embed Frameworks";
29+ runOnlyForDeploymentPostprocessing = 0;
30+ };
31+/* End PBXCopyFilesBuildPhase section */
32+
33+/* Begin PBXFileReference section */
34+ BEB77548207267E400201EBB /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
35+ BEB7754B207267E400201EBB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
36+ BEB7754D207267E400201EBB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
37+ BEB77550207267E400201EBB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
38+ BEB77552207267E500201EBB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
39+ BEB77555207267E500201EBB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
40+ BEB77557207267E500201EBB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
41+ BEB7755D207267F800201EBB /* HueKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = HueKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
42+/* End PBXFileReference section */
43+
44+/* Begin PBXFrameworksBuildPhase section */
45+ BEB77545207267E400201EBB /* Frameworks */ = {
46+ isa = PBXFrameworksBuildPhase;
47+ buildActionMask = 2147483647;
48+ files = (
49+ BEB7755E207267F800201EBB /* HueKit.framework in Frameworks */,
50+ );
51+ runOnlyForDeploymentPostprocessing = 0;
52+ };
53+/* End PBXFrameworksBuildPhase section */
54+
55+/* Begin PBXGroup section */
56+ BEB7753F207267E400201EBB = {
57+ isa = PBXGroup;
58+ children = (
59+ BEB7755D207267F800201EBB /* HueKit.framework */,
60+ BEB7754A207267E400201EBB /* Example */,
61+ BEB77549207267E400201EBB /* Products */,
62+ );
63+ sourceTree = "<group>";
64+ };
65+ BEB77549207267E400201EBB /* Products */ = {
66+ isa = PBXGroup;
67+ children = (
68+ BEB77548207267E400201EBB /* Example.app */,
69+ );
70+ name = Products;
71+ sourceTree = "<group>";
72+ };
73+ BEB7754A207267E400201EBB /* Example */ = {
74+ isa = PBXGroup;
75+ children = (
76+ BEB7754B207267E400201EBB /* AppDelegate.swift */,
77+ BEB7754D207267E400201EBB /* ViewController.swift */,
78+ BEB7754F207267E400201EBB /* Main.storyboard */,
79+ BEB77552207267E500201EBB /* Assets.xcassets */,
80+ BEB77554207267E500201EBB /* LaunchScreen.storyboard */,
81+ BEB77557207267E500201EBB /* Info.plist */,
82+ );
83+ path = Example;
84+ sourceTree = "<group>";
85+ };
86+/* End PBXGroup section */
87+
88+/* Begin PBXNativeTarget section */
89+ BEB77547207267E400201EBB /* Example */ = {
90+ isa = PBXNativeTarget;
91+ buildConfigurationList = BEB7755A207267E500201EBB /* Build configuration list for PBXNativeTarget "Example" */;
92+ buildPhases = (
93+ BEB77544207267E400201EBB /* Sources */,
94+ BEB77545207267E400201EBB /* Frameworks */,
95+ BEB77546207267E400201EBB /* Resources */,
96+ BEB77560207267F800201EBB /* Embed Frameworks */,
97+ );
98+ buildRules = (
99+ );
100+ dependencies = (
101+ );
102+ name = Example;
103+ productName = Example;
104+ productReference = BEB77548207267E400201EBB /* Example.app */;
105+ productType = "com.apple.product-type.application";
106+ };
107+/* End PBXNativeTarget section */
108+
109+/* Begin PBXProject section */
110+ BEB77540207267E400201EBB /* Project object */ = {
111+ isa = PBXProject;
112+ attributes = {
113+ LastSwiftUpdateCheck = 0930;
114+ LastUpgradeCheck = 0930;
115+ ORGANIZATIONNAME = "Silver Fox";
116+ TargetAttributes = {
117+ BEB77547207267E400201EBB = {
118+ CreatedOnToolsVersion = 9.3;
119+ };
120+ };
121+ };
122+ buildConfigurationList = BEB77543207267E400201EBB /* Build configuration list for PBXProject "Example" */;
123+ compatibilityVersion = "Xcode 9.3";
124+ developmentRegion = en;
125+ hasScannedForEncodings = 0;
126+ knownRegions = (
127+ en,
128+ Base,
129+ );
130+ mainGroup = BEB7753F207267E400201EBB;
131+ productRefGroup = BEB77549207267E400201EBB /* Products */;
132+ projectDirPath = "";
133+ projectRoot = "";
134+ targets = (
135+ BEB77547207267E400201EBB /* Example */,
136+ );
137+ };
138+/* End PBXProject section */
139+
140+/* Begin PBXResourcesBuildPhase section */
141+ BEB77546207267E400201EBB /* Resources */ = {
142+ isa = PBXResourcesBuildPhase;
143+ buildActionMask = 2147483647;
144+ files = (
145+ BEB77556207267E500201EBB /* LaunchScreen.storyboard in Resources */,
146+ BEB77553207267E500201EBB /* Assets.xcassets in Resources */,
147+ BEB77551207267E400201EBB /* Main.storyboard in Resources */,
148+ );
149+ runOnlyForDeploymentPostprocessing = 0;
150+ };
151+/* End PBXResourcesBuildPhase section */
152+
153+/* Begin PBXSourcesBuildPhase section */
154+ BEB77544207267E400201EBB /* Sources */ = {
155+ isa = PBXSourcesBuildPhase;
156+ buildActionMask = 2147483647;
157+ files = (
158+ BEB7754E207267E400201EBB /* ViewController.swift in Sources */,
159+ BEB7754C207267E400201EBB /* AppDelegate.swift in Sources */,
160+ );
161+ runOnlyForDeploymentPostprocessing = 0;
162+ };
163+/* End PBXSourcesBuildPhase section */
164+
165+/* Begin PBXVariantGroup section */
166+ BEB7754F207267E400201EBB /* Main.storyboard */ = {
167+ isa = PBXVariantGroup;
168+ children = (
169+ BEB77550207267E400201EBB /* Base */,
170+ );
171+ name = Main.storyboard;
172+ sourceTree = "<group>";
173+ };
174+ BEB77554207267E500201EBB /* LaunchScreen.storyboard */ = {
175+ isa = PBXVariantGroup;
176+ children = (
177+ BEB77555207267E500201EBB /* Base */,
178+ );
179+ name = LaunchScreen.storyboard;
180+ sourceTree = "<group>";
181+ };
182+/* End PBXVariantGroup section */
183+
184+/* Begin XCBuildConfiguration section */
185+ BEB77558207267E500201EBB /* Debug */ = {
186+ isa = XCBuildConfiguration;
187+ buildSettings = {
188+ ALWAYS_SEARCH_USER_PATHS = NO;
189+ CLANG_ANALYZER_NONNULL = YES;
190+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
191+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
192+ CLANG_CXX_LIBRARY = "libc++";
193+ CLANG_ENABLE_MODULES = YES;
194+ CLANG_ENABLE_OBJC_ARC = YES;
195+ CLANG_ENABLE_OBJC_WEAK = YES;
196+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
197+ CLANG_WARN_BOOL_CONVERSION = YES;
198+ CLANG_WARN_COMMA = YES;
199+ CLANG_WARN_CONSTANT_CONVERSION = YES;
200+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
201+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
202+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
203+ CLANG_WARN_EMPTY_BODY = YES;
204+ CLANG_WARN_ENUM_CONVERSION = YES;
205+ CLANG_WARN_INFINITE_RECURSION = YES;
206+ CLANG_WARN_INT_CONVERSION = YES;
207+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
208+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
209+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
210+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
211+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
212+ CLANG_WARN_STRICT_PROTOTYPES = YES;
213+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
214+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
215+ CLANG_WARN_UNREACHABLE_CODE = YES;
216+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
217+ CODE_SIGN_IDENTITY = "iPhone Developer";
218+ COPY_PHASE_STRIP = NO;
219+ DEBUG_INFORMATION_FORMAT = dwarf;
220+ ENABLE_STRICT_OBJC_MSGSEND = YES;
221+ ENABLE_TESTABILITY = YES;
222+ GCC_C_LANGUAGE_STANDARD = gnu11;
223+ GCC_DYNAMIC_NO_PIC = NO;
224+ GCC_NO_COMMON_BLOCKS = YES;
225+ GCC_OPTIMIZATION_LEVEL = 0;
226+ GCC_PREPROCESSOR_DEFINITIONS = (
227+ "DEBUG=1",
228+ "$(inherited)",
229+ );
230+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
231+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
232+ GCC_WARN_UNDECLARED_SELECTOR = YES;
233+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
234+ GCC_WARN_UNUSED_FUNCTION = YES;
235+ GCC_WARN_UNUSED_VARIABLE = YES;
236+ IPHONEOS_DEPLOYMENT_TARGET = 11.3;
237+ MTL_ENABLE_DEBUG_INFO = YES;
238+ ONLY_ACTIVE_ARCH = YES;
239+ SDKROOT = iphoneos;
240+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
241+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
242+ };
243+ name = Debug;
244+ };
245+ BEB77559207267E500201EBB /* Release */ = {
246+ isa = XCBuildConfiguration;
247+ buildSettings = {
248+ ALWAYS_SEARCH_USER_PATHS = NO;
249+ CLANG_ANALYZER_NONNULL = YES;
250+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
251+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
252+ CLANG_CXX_LIBRARY = "libc++";
253+ CLANG_ENABLE_MODULES = YES;
254+ CLANG_ENABLE_OBJC_ARC = YES;
255+ CLANG_ENABLE_OBJC_WEAK = YES;
256+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
257+ CLANG_WARN_BOOL_CONVERSION = YES;
258+ CLANG_WARN_COMMA = YES;
259+ CLANG_WARN_CONSTANT_CONVERSION = YES;
260+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
261+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
262+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
263+ CLANG_WARN_EMPTY_BODY = YES;
264+ CLANG_WARN_ENUM_CONVERSION = YES;
265+ CLANG_WARN_INFINITE_RECURSION = YES;
266+ CLANG_WARN_INT_CONVERSION = YES;
267+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
268+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
269+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
270+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
271+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
272+ CLANG_WARN_STRICT_PROTOTYPES = YES;
273+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
274+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
275+ CLANG_WARN_UNREACHABLE_CODE = YES;
276+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
277+ CODE_SIGN_IDENTITY = "iPhone Developer";
278+ COPY_PHASE_STRIP = NO;
279+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
280+ ENABLE_NS_ASSERTIONS = NO;
281+ ENABLE_STRICT_OBJC_MSGSEND = YES;
282+ GCC_C_LANGUAGE_STANDARD = gnu11;
283+ GCC_NO_COMMON_BLOCKS = YES;
284+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
285+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
286+ GCC_WARN_UNDECLARED_SELECTOR = YES;
287+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
288+ GCC_WARN_UNUSED_FUNCTION = YES;
289+ GCC_WARN_UNUSED_VARIABLE = YES;
290+ IPHONEOS_DEPLOYMENT_TARGET = 11.3;
291+ MTL_ENABLE_DEBUG_INFO = NO;
292+ SDKROOT = iphoneos;
293+ SWIFT_COMPILATION_MODE = wholemodule;
294+ SWIFT_OPTIMIZATION_LEVEL = "-O";
295+ VALIDATE_PRODUCT = YES;
296+ };
297+ name = Release;
298+ };
299+ BEB7755B207267E500201EBB /* Debug */ = {
300+ isa = XCBuildConfiguration;
301+ buildSettings = {
302+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
303+ CODE_SIGN_STYLE = Automatic;
304+ DEVELOPMENT_TEAM = 6G5LMQ72D8;
305+ INFOPLIST_FILE = Example/Info.plist;
306+ IPHONEOS_DEPLOYMENT_TARGET = 10.0;
307+ LD_RUNPATH_SEARCH_PATHS = (
308+ "$(inherited)",
309+ "@executable_path/Frameworks",
310+ );
311+ PRODUCT_BUNDLE_IDENTIFIER = be.silverfox.Example;
312+ PRODUCT_NAME = "$(TARGET_NAME)";
313+ SWIFT_VERSION = 4.0;
314+ TARGETED_DEVICE_FAMILY = "1,2";
315+ };
316+ name = Debug;
317+ };
318+ BEB7755C207267E500201EBB /* Release */ = {
319+ isa = XCBuildConfiguration;
320+ buildSettings = {
321+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
322+ CODE_SIGN_STYLE = Automatic;
323+ DEVELOPMENT_TEAM = 6G5LMQ72D8;
324+ INFOPLIST_FILE = Example/Info.plist;
325+ IPHONEOS_DEPLOYMENT_TARGET = 10.0;
326+ LD_RUNPATH_SEARCH_PATHS = (
327+ "$(inherited)",
328+ "@executable_path/Frameworks",
329+ );
330+ PRODUCT_BUNDLE_IDENTIFIER = be.silverfox.Example;
331+ PRODUCT_NAME = "$(TARGET_NAME)";
332+ SWIFT_VERSION = 4.0;
333+ TARGETED_DEVICE_FAMILY = "1,2";
334+ };
335+ name = Release;
336+ };
337+/* End XCBuildConfiguration section */
338+
339+/* Begin XCConfigurationList section */
340+ BEB77543207267E400201EBB /* Build configuration list for PBXProject "Example" */ = {
341+ isa = XCConfigurationList;
342+ buildConfigurations = (
343+ BEB77558207267E500201EBB /* Debug */,
344+ BEB77559207267E500201EBB /* Release */,
345+ );
346+ defaultConfigurationIsVisible = 0;
347+ defaultConfigurationName = Release;
348+ };
349+ BEB7755A207267E500201EBB /* Build configuration list for PBXNativeTarget "Example" */ = {
350+ isa = XCConfigurationList;
351+ buildConfigurations = (
352+ BEB7755B207267E500201EBB /* Debug */,
353+ BEB7755C207267E500201EBB /* Release */,
354+ );
355+ defaultConfigurationIsVisible = 0;
356+ defaultConfigurationName = Release;
357+ };
358+/* End XCConfigurationList section */
359+ };
360+ rootObject = BEB77540207267E400201EBB /* Project object */;
361+}
Example/Example/AppDelegate.swiftnew file+46
@@ -0,0 +1,46 @@
1+//
2+// AppDelegate.swift
3+// Example
4+//
5+// Created by Louis D'hauwe on 02/04/2018.
6+// Copyright © 2018 Silver Fox. 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: [UIApplicationLaunchOptionsKey: 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+
Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.jsonnew file+98
@@ -0,0 +1,98 @@
1+{
2+ "images" : [
3+ {
4+ "idiom" : "iphone",
5+ "size" : "20x20",
6+ "scale" : "2x"
7+ },
8+ {
9+ "idiom" : "iphone",
10+ "size" : "20x20",
11+ "scale" : "3x"
12+ },
13+ {
14+ "idiom" : "iphone",
15+ "size" : "29x29",
16+ "scale" : "2x"
17+ },
18+ {
19+ "idiom" : "iphone",
20+ "size" : "29x29",
21+ "scale" : "3x"
22+ },
23+ {
24+ "idiom" : "iphone",
25+ "size" : "40x40",
26+ "scale" : "2x"
27+ },
28+ {
29+ "idiom" : "iphone",
30+ "size" : "40x40",
31+ "scale" : "3x"
32+ },
33+ {
34+ "idiom" : "iphone",
35+ "size" : "60x60",
36+ "scale" : "2x"
37+ },
38+ {
39+ "idiom" : "iphone",
40+ "size" : "60x60",
41+ "scale" : "3x"
42+ },
43+ {
44+ "idiom" : "ipad",
45+ "size" : "20x20",
46+ "scale" : "1x"
47+ },
48+ {
49+ "idiom" : "ipad",
50+ "size" : "20x20",
51+ "scale" : "2x"
52+ },
53+ {
54+ "idiom" : "ipad",
55+ "size" : "29x29",
56+ "scale" : "1x"
57+ },
58+ {
59+ "idiom" : "ipad",
60+ "size" : "29x29",
61+ "scale" : "2x"
62+ },
63+ {
64+ "idiom" : "ipad",
65+ "size" : "40x40",
66+ "scale" : "1x"
67+ },
68+ {
69+ "idiom" : "ipad",
70+ "size" : "40x40",
71+ "scale" : "2x"
72+ },
73+ {
74+ "idiom" : "ipad",
75+ "size" : "76x76",
76+ "scale" : "1x"
77+ },
78+ {
79+ "idiom" : "ipad",
80+ "size" : "76x76",
81+ "scale" : "2x"
82+ },
83+ {
84+ "idiom" : "ipad",
85+ "size" : "83.5x83.5",
86+ "scale" : "2x"
87+ },
88+ {
89+ "idiom" : "ios-marketing",
90+ "size" : "1024x1024",
91+ "scale" : "1x"
92+ }
93+ ],
94+ "info" : {
95+ "version" : 1,
96+ "author" : "xcode"
97+ }
98+}
Example/Example/Assets.xcassets/Contents.jsonnew file+6
@@ -0,0 +1,6 @@
1+{
2+ "info" : {
3+ "version" : 1,
4+ "author" : "xcode"
5+ }
6+}
Example/Example/Base.lproj/LaunchScreen.storyboardnew file+25
@@ -0,0 +1,25 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+ <dependencies>
4+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5+ <capability name="Safe area layout guides" minToolsVersion="9.0"/>
6+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
7+ </dependencies>
8+ <scenes>
9+ <!--View Controller-->
10+ <scene sceneID="EHf-IW-A2E">
11+ <objects>
12+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
13+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
14+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
15+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
17+ <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
18+ </view>
19+ </viewController>
20+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
21+ </objects>
22+ <point key="canvasLocation" x="53" y="375"/>
23+ </scene>
24+ </scenes>
25+</document>
Example/Example/Base.lproj/Main.storyboardnew file+206
@@ -0,0 +1,206 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="8Fw-bv-Lqp">
3+ <device id="retina4_7" orientation="portrait">
4+ <adaptation id="fullscreen"/>
5+ </device>
6+ <dependencies>
7+ <deployment identifier="iOS"/>
8+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
9+ <capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
10+ <capability name="Safe area layout guides" minToolsVersion="9.0"/>
11+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
12+ </dependencies>
13+ <scenes>
14+ <!--HueKit Example-->
15+ <scene sceneID="tne-QT-ifu">
16+ <objects>
17+ <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
18+ <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
19+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
20+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
21+ <subviews>
22+ <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="Tr0-NJ-glz">
23+ <rect key="frame" x="27.5" y="72" width="320" height="518.5"/>
24+ <subviews>
25+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zdi-0K-woj" customClass="ColorSquarePicker" customModule="HueKit">
26+ <rect key="frame" x="0.0" y="0.0" width="320" height="320"/>
27+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
28+ <constraints>
29+ <constraint firstAttribute="width" secondItem="zdi-0K-woj" secondAttribute="height" multiplier="1:1" id="KwV-0T-f2e"/>
30+ </constraints>
31+ <userDefinedRuntimeAttributes>
32+ <userDefinedRuntimeAttribute type="point" keyPath="value">
33+ <point key="value" x="0.0" y="0.0"/>
34+ </userDefinedRuntimeAttribute>
35+ </userDefinedRuntimeAttributes>
36+ <connections>
37+ <action selector="colorSquarePickerValueChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="DaQ-xT-J8e"/>
38+ </connections>
39+ </view>
40+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ht2-O7-0f1" customClass="ColorBarPicker" customModule="HueKit">
41+ <rect key="frame" x="0.0" y="320" width="320" height="44"/>
42+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
43+ <constraints>
44+ <constraint firstAttribute="height" constant="44" id="HJ2-He-zzk"/>
45+ </constraints>
46+ <connections>
47+ <action selector="colorBarPickerValueChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="hie-BA-aJU"/>
48+ </connections>
49+ </view>
50+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UMo-bw-pvL">
51+ <rect key="frame" x="0.0" y="364" width="320" height="154.5"/>
52+ <subviews>
53+ <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="6xm-ns-jG5">
54+ <rect key="frame" x="20" y="20" width="280" height="114.5"/>
55+ <subviews>
56+ <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="GZz-Je-2gO">
57+ <rect key="frame" x="0.0" y="0.0" width="280" height="73.5"/>
58+ <subviews>
59+ <stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="Yye-8l-cBt">
60+ <rect key="frame" x="0.0" y="0.0" width="280" height="32.5"/>
61+ <subviews>
62+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="R:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9BS-9j-1x8">
63+ <rect key="frame" x="0.0" y="0.0" width="93.5" height="32.5"/>
64+ <fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="17"/>
65+ <nil key="textColor"/>
66+ <nil key="highlightedColor"/>
67+ </label>
68+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="G:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="euH-5z-YuL">
69+ <rect key="frame" x="93.5" y="0.0" width="93" height="32.5"/>
70+ <fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="17"/>
71+ <nil key="textColor"/>
72+ <nil key="highlightedColor"/>
73+ </label>
74+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="B:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vqz-K4-h3x">
75+ <rect key="frame" x="186.5" y="0.0" width="93.5" height="32.5"/>
76+ <fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="17"/>
77+ <nil key="textColor"/>
78+ <nil key="highlightedColor"/>
79+ </label>
80+ </subviews>
81+ </stackView>
82+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zbY-pB-SO7">
83+ <rect key="frame" x="0.0" y="36.5" width="280" height="1"/>
84+ <color key="backgroundColor" white="0.85195312499999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
85+ <constraints>
86+ <constraint firstAttribute="height" constant="1" id="KMO-Jy-7nJ"/>
87+ </constraints>
88+ </view>
89+ <stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="Lpu-I1-JEV">
90+ <rect key="frame" x="0.0" y="41.5" width="280" height="32"/>
91+ <subviews>
92+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="H:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="539-Mk-3VV">
93+ <rect key="frame" x="0.0" y="0.0" width="93.5" height="32"/>
94+ <fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="17"/>
95+ <nil key="textColor"/>
96+ <nil key="highlightedColor"/>
97+ </label>
98+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="S:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="16l-vt-EZG">
99+ <rect key="frame" x="93.5" y="0.0" width="93" height="32"/>
100+ <fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="17"/>
101+ <nil key="textColor"/>
102+ <nil key="highlightedColor"/>
103+ </label>
104+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="V:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sRv-69-Kyf">
105+ <rect key="frame" x="186.5" y="0.0" width="93.5" height="32"/>
106+ <fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="17"/>
107+ <nil key="textColor"/>
108+ <nil key="highlightedColor"/>
109+ </label>
110+ </subviews>
111+ </stackView>
112+ </subviews>
113+ <constraints>
114+ <constraint firstItem="Lpu-I1-JEV" firstAttribute="height" secondItem="Yye-8l-cBt" secondAttribute="height" id="uhk-1i-KRK"/>
115+ </constraints>
116+ </stackView>
117+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zJG-Df-vgl">
118+ <rect key="frame" x="0.0" y="77.5" width="280" height="1"/>
119+ <color key="backgroundColor" white="0.85195312499999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
120+ <constraints>
121+ <constraint firstAttribute="height" constant="1" id="liA-ZC-ZMS"/>
122+ </constraints>
123+ </view>
124+ <stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="FQM-eG-Kx1">
125+ <rect key="frame" x="0.0" y="82.5" width="280" height="32"/>
126+ <subviews>
127+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="F9X-aB-MKf" customClass="ColorIndicatorView" customModule="HueKit">
128+ <rect key="frame" x="0.0" y="0.0" width="32" height="32"/>
129+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
130+ <constraints>
131+ <constraint firstAttribute="width" secondItem="F9X-aB-MKf" secondAttribute="height" multiplier="1:1" id="5ff-Qa-LF2"/>
132+ <constraint firstAttribute="width" constant="32" id="7PF-Y2-rat"/>
133+ </constraints>
134+ </view>
135+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="#000000" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aBX-c2-og2">
136+ <rect key="frame" x="40" y="0.0" width="240" height="32"/>
137+ <fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="17"/>
138+ <nil key="textColor"/>
139+ <nil key="highlightedColor"/>
140+ </label>
141+ </subviews>
142+ </stackView>
143+ </subviews>
144+ <constraints>
145+ <constraint firstItem="FQM-eG-Kx1" firstAttribute="height" secondItem="Lpu-I1-JEV" secondAttribute="height" id="7tw-z3-RhV"/>
146+ </constraints>
147+ </stackView>
148+ </subviews>
149+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
150+ <constraints>
151+ <constraint firstAttribute="bottom" secondItem="6xm-ns-jG5" secondAttribute="bottom" constant="20" id="QhR-Z9-V4H"/>
152+ <constraint firstAttribute="trailing" secondItem="6xm-ns-jG5" secondAttribute="trailing" constant="20" id="S5r-aC-jbg"/>
153+ <constraint firstItem="6xm-ns-jG5" firstAttribute="leading" secondItem="UMo-bw-pvL" secondAttribute="leading" constant="20" id="ZWD-CF-djw"/>
154+ <constraint firstItem="6xm-ns-jG5" firstAttribute="top" secondItem="UMo-bw-pvL" secondAttribute="top" constant="20" id="u3d-v9-Fe9"/>
155+ </constraints>
156+ </view>
157+ </subviews>
158+ <constraints>
159+ <constraint firstAttribute="width" constant="320" id="g1S-Ws-Nbz"/>
160+ </constraints>
161+ </stackView>
162+ </subviews>
163+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
164+ <constraints>
165+ <constraint firstItem="Tr0-NJ-glz" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="SEn-Gx-KKW"/>
166+ <constraint firstItem="Tr0-NJ-glz" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="8" id="jer-1Y-YsK"/>
167+ </constraints>
168+ <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
169+ </view>
170+ <navigationItem key="navigationItem" title="HueKit Example" id="eA9-XS-nqp"/>
171+ <connections>
172+ <outlet property="bLabel" destination="Vqz-K4-h3x" id="Lcv-rh-t9r"/>
173+ <outlet property="colorIndicatorView" destination="F9X-aB-MKf" id="Mtx-hM-w9Z"/>
174+ <outlet property="colorSquarePicker" destination="zdi-0K-woj" id="tPX-oR-0VC"/>
175+ <outlet property="gLabel" destination="euH-5z-YuL" id="wJ5-5E-77k"/>
176+ <outlet property="hLabel" destination="539-Mk-3VV" id="e5s-5c-P4J"/>
177+ <outlet property="hexLabel" destination="aBX-c2-og2" id="Idh-jp-r44"/>
178+ <outlet property="rLabel" destination="9BS-9j-1x8" id="qZg-q3-WRl"/>
179+ <outlet property="sLabel" destination="16l-vt-EZG" id="fKa-nb-sM2"/>
180+ <outlet property="vLabel" destination="sRv-69-Kyf" id="bjq-dp-QFi"/>
181+ </connections>
182+ </viewController>
183+ <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
184+ </objects>
185+ <point key="canvasLocation" x="1076" y="133.5832083958021"/>
186+ </scene>
187+ <!--Navigation Controller-->
188+ <scene sceneID="Bxk-8d-r3b">
189+ <objects>
190+ <navigationController automaticallyAdjustsScrollViewInsets="NO" id="8Fw-bv-Lqp" sceneMemberID="viewController">
191+ <toolbarItems/>
192+ <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="5Ii-tA-Bk8">
193+ <rect key="frame" x="0.0" y="20" width="375" height="44"/>
194+ <autoresizingMask key="autoresizingMask"/>
195+ </navigationBar>
196+ <nil name="viewControllers"/>
197+ <connections>
198+ <segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="w8A-a3-8JC"/>
199+ </connections>
200+ </navigationController>
201+ <placeholder placeholderIdentifier="IBFirstResponder" id="Vtp-Ht-Dz3" userLabel="First Responder" sceneMemberID="firstResponder"/>
202+ </objects>
203+ <point key="canvasLocation" x="136.80000000000001" y="133.5832083958021"/>
204+ </scene>
205+ </scenes>
206+</document>
Example/Example/Info.plistnew file+45
@@ -0,0 +1,45 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+<plist version="1.0">
4+<dict>
5+ <key>CFBundleDevelopmentRegion</key>
6+ <string>$(DEVELOPMENT_LANGUAGE)</string>
7+ <key>CFBundleExecutable</key>
8+ <string>$(EXECUTABLE_NAME)</string>
9+ <key>CFBundleIdentifier</key>
10+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+ <key>CFBundleInfoDictionaryVersion</key>
12+ <string>6.0</string>
13+ <key>CFBundleName</key>
14+ <string>$(PRODUCT_NAME)</string>
15+ <key>CFBundlePackageType</key>
16+ <string>APPL</string>
17+ <key>CFBundleShortVersionString</key>
18+ <string>1.0</string>
19+ <key>CFBundleVersion</key>
20+ <string>1</string>
21+ <key>LSRequiresIPhoneOS</key>
22+ <true/>
23+ <key>UILaunchStoryboardName</key>
24+ <string>LaunchScreen</string>
25+ <key>UIMainStoryboardFile</key>
26+ <string>Main</string>
27+ <key>UIRequiredDeviceCapabilities</key>
28+ <array>
29+ <string>armv7</string>
30+ </array>
31+ <key>UISupportedInterfaceOrientations</key>
32+ <array>
33+ <string>UIInterfaceOrientationPortrait</string>
34+ <string>UIInterfaceOrientationLandscapeLeft</string>
35+ <string>UIInterfaceOrientationLandscapeRight</string>
36+ </array>
37+ <key>UISupportedInterfaceOrientations~ipad</key>
38+ <array>
39+ <string>UIInterfaceOrientationPortrait</string>
40+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
41+ <string>UIInterfaceOrientationLandscapeLeft</string>
42+ <string>UIInterfaceOrientationLandscapeRight</string>
43+ </array>
44+</dict>
45+</plist>
Example/Example/ViewController.swiftnew file+84
@@ -0,0 +1,84 @@
1+//
2+// ViewController.swift
3+// Example
4+//
5+// Created by Louis D'hauwe on 02/04/2018.
6+// Copyright © 2018 Silver Fox. All rights reserved.
7+//
8+
9+import UIKit
10+import HueKit
11+
12+class ViewController: UIViewController {
13+
14+ @IBOutlet weak var colorSquarePicker: ColorSquarePicker!
15+ @IBOutlet weak var colorIndicatorView: ColorIndicatorView!
16+
17+ @IBOutlet weak var rLabel: UILabel!
18+ @IBOutlet weak var gLabel: UILabel!
19+ @IBOutlet weak var bLabel: UILabel!
20+
21+ @IBOutlet weak var hLabel: UILabel!
22+ @IBOutlet weak var sLabel: UILabel!
23+ @IBOutlet weak var vLabel: UILabel!
24+
25+ @IBOutlet weak var hexLabel: UILabel!
26+
27+ override func viewDidLoad() {
28+ super.viewDidLoad()
29+
30+ didChangeColor(colorSquarePicker.color)
31+
32+ }
33+
34+ @IBAction func colorBarPickerValueChanged(_ sender: ColorBarPicker) {
35+
36+ colorSquarePicker.hue = sender.hue
37+ didChangeColor(colorSquarePicker.color)
38+
39+ }
40+
41+ @IBAction func colorSquarePickerValueChanged(_ sender: ColorSquarePicker) {
42+
43+ didChangeColor(sender.color)
44+
45+ }
46+
47+ func didChangeColor(_ color: UIColor) {
48+
49+ guard let rgbValue = color.rgbValue else {
50+ return
51+ }
52+
53+ guard let hsvValue = color.hsvValue else {
54+ return
55+ }
56+
57+ rLabel.text = String(format: "R: %.f", rgbValue.r * 255)
58+ gLabel.text = String(format: "G: %.f", rgbValue.g * 255)
59+ bLabel.text = String(format: "B: %.f", rgbValue.b * 255)
60+
61+ hLabel.text = String(format: "H: %.f°", hsvValue.h * 360)
62+ sLabel.text = String(format: "S: %.f%%", hsvValue.s * 100)
63+ vLabel.text = String(format: "V: %.f%%", hsvValue.v * 100)
64+
65+ hexLabel.text = color.hexString
66+ colorIndicatorView.color = color
67+
68+ }
69+
70+}
71+
72+extension UIColor {
73+
74+ public var hexString: String {
75+ var r: CGFloat = 0
76+ var g: CGFloat = 0
77+ var b: CGFloat = 0
78+ var a: CGFloat = 0
79+ self.getRed(&r, green: &g, blue: &b, alpha: &a)
80+
81+ return String(format: "#%02X%02X%02X", Int(r * 255), Int(g * 255), Int(b * 255))
82+ }
83+
84+}
HueKit.podspecnew file+14
@@ -0,0 +1,14 @@
1+Pod::Spec.new do |s|
2+ s.name = 'HueKit'
3+ s.version = '1.0.1'
4+ s.license = 'MIT'
5+ s.summary = 'A UI framework for iOS that provides components and utilities for building color pickers.'
6+ s.homepage = 'https://github.com/louisdh/huekit'
7+ s.social_media_url = 'http://twitter.com/LouisDhauwe'
8+ s.authors = { 'Louis D\'hauwe' => 'louisdhauwe@silverfox.be' }
9+ s.source = { :git => 'https://github.com/louisdh/huekit.git', :tag => s.version }
10+
11+ s.ios.deployment_target = '10.0'
12+
13+ s.source_files = 'HueKit/**/*.swift'
14+end
HueKit.xcodeproj/project.pbxproj+14−5
@@ -150,14 +150,14 @@
150150 BE5C1E0E1F3266B600B0080C /* Project object */ = {
151151 isa = PBXProject;
152152 attributes = {
153− LastUpgradeCheck = 0900;
153+ LastSwiftUpdateCheck = 0930;
154+ LastUpgradeCheck = 0930;
154155 ORGANIZATIONNAME = "Silver Fox";
155156 TargetAttributes = {
156157 BE5C1E161F3266B600B0080C = {
157158 CreatedOnToolsVersion = 8.3.3;
158− DevelopmentTeam = 6G5LMQ72D8;
159159 LastSwiftMigration = 0900;
160− ProvisioningStyle = Automatic;
160+ ProvisioningStyle = Manual;
161161 };
162162 };
163163 };
@@ -167,6 +167,7 @@
167167 hasScannedForEncodings = 0;
168168 knownRegions = (
169169 en,
170+ Base,
170171 );
171172 mainGroup = BE5C1E0D1F3266B600B0080C;
172173 productRefGroup = BE5C1E181F3266B600B0080C /* Products */;
@@ -225,6 +226,7 @@
225226 CLANG_WARN_BOOL_CONVERSION = YES;
226227 CLANG_WARN_COMMA = YES;
227228 CLANG_WARN_CONSTANT_CONVERSION = YES;
229+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
228230 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
229231 CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
230232 CLANG_WARN_EMPTY_BODY = YES;
@@ -232,6 +234,7 @@
232234 CLANG_WARN_INFINITE_RECURSION = YES;
233235 CLANG_WARN_INT_CONVERSION = YES;
234236 CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
237+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
235238 CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
236239 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
237240 CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -285,6 +288,7 @@
285288 CLANG_WARN_BOOL_CONVERSION = YES;
286289 CLANG_WARN_COMMA = YES;
287290 CLANG_WARN_CONSTANT_CONVERSION = YES;
291+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
288292 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
289293 CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
290294 CLANG_WARN_EMPTY_BODY = YES;
@@ -292,6 +296,7 @@
292296 CLANG_WARN_INFINITE_RECURSION = YES;
293297 CLANG_WARN_INT_CONVERSION = YES;
294298 CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
299+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
295300 CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
296301 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
297302 CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -329,9 +334,10 @@
329334 buildSettings = {
330335 CLANG_ENABLE_MODULES = YES;
331336 CODE_SIGN_IDENTITY = "";
337+ CODE_SIGN_STYLE = Manual;
332338 DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
333339 DEFINES_MODULE = YES;
334− DEVELOPMENT_TEAM = 6G5LMQ72D8;
340+ DEVELOPMENT_TEAM = "";
335341 DYLIB_COMPATIBILITY_VERSION = 1;
336342 DYLIB_CURRENT_VERSION = 1;
337343 DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -341,6 +347,7 @@
341347 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
342348 PRODUCT_BUNDLE_IDENTIFIER = be.silverfox.HueKit;
343349 PRODUCT_NAME = "$(TARGET_NAME)";
350+ PROVISIONING_PROFILE_SPECIFIER = "";
344351 SKIP_INSTALL = YES;
345352 SWIFT_OPTIMIZATION_LEVEL = "-Onone";
346353 SWIFT_SWIFT3_OBJC_INFERENCE = Default;
@@ -353,8 +360,9 @@
353360 buildSettings = {
354361 CLANG_ENABLE_MODULES = YES;
355362 CODE_SIGN_IDENTITY = "";
363+ CODE_SIGN_STYLE = Manual;
356364 DEFINES_MODULE = YES;
357− DEVELOPMENT_TEAM = 6G5LMQ72D8;
365+ DEVELOPMENT_TEAM = "";
358366 DYLIB_COMPATIBILITY_VERSION = 1;
359367 DYLIB_CURRENT_VERSION = 1;
360368 DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -364,6 +372,7 @@
364372 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
365373 PRODUCT_BUNDLE_IDENTIFIER = be.silverfox.HueKit;
366374 PRODUCT_NAME = "$(TARGET_NAME)";
375+ PROVISIONING_PROFILE_SPECIFIER = "";
367376 SKIP_INSTALL = YES;
368377 SWIFT_SWIFT3_OBJC_INFERENCE = Default;
369378 SWIFT_VERSION = 4.0;
HueKit.xcodeproj/xcshareddata/xcschemes/iOS.xcschemenew file+80
@@ -0,0 +1,80 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<Scheme
3+ LastUpgradeVersion = "0930"
4+ version = "1.3">
5+ <BuildAction
6+ parallelizeBuildables = "YES"
7+ buildImplicitDependencies = "YES">
8+ <BuildActionEntries>
9+ <BuildActionEntry
10+ buildForTesting = "YES"
11+ buildForRunning = "YES"
12+ buildForProfiling = "YES"
13+ buildForArchiving = "YES"
14+ buildForAnalyzing = "YES">
15+ <BuildableReference
16+ BuildableIdentifier = "primary"
17+ BlueprintIdentifier = "BE5C1E161F3266B600B0080C"
18+ BuildableName = "HueKit.framework"
19+ BlueprintName = "HueKit"
20+ ReferencedContainer = "container:HueKit.xcodeproj">
21+ </BuildableReference>
22+ </BuildActionEntry>
23+ </BuildActionEntries>
24+ </BuildAction>
25+ <TestAction
26+ buildConfiguration = "Debug"
27+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+ shouldUseLaunchSchemeArgsEnv = "YES">
30+ <Testables>
31+ </Testables>
32+ <AdditionalOptions>
33+ </AdditionalOptions>
34+ </TestAction>
35+ <LaunchAction
36+ buildConfiguration = "Debug"
37+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
38+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
39+ launchStyle = "0"
40+ useCustomWorkingDirectory = "NO"
41+ ignoresPersistentStateOnLaunch = "NO"
42+ debugDocumentVersioning = "YES"
43+ debugServiceExtension = "internal"
44+ allowLocationSimulation = "YES">
45+ <MacroExpansion>
46+ <BuildableReference
47+ BuildableIdentifier = "primary"
48+ BlueprintIdentifier = "BE5C1E161F3266B600B0080C"
49+ BuildableName = "HueKit.framework"
50+ BlueprintName = "HueKit"
51+ ReferencedContainer = "container:HueKit.xcodeproj">
52+ </BuildableReference>
53+ </MacroExpansion>
54+ <AdditionalOptions>
55+ </AdditionalOptions>
56+ </LaunchAction>
57+ <ProfileAction
58+ buildConfiguration = "Release"
59+ shouldUseLaunchSchemeArgsEnv = "YES"
60+ savedToolIdentifier = ""
61+ useCustomWorkingDirectory = "NO"
62+ debugDocumentVersioning = "YES">
63+ <MacroExpansion>
64+ <BuildableReference
65+ BuildableIdentifier = "primary"
66+ BlueprintIdentifier = "BE5C1E161F3266B600B0080C"
67+ BuildableName = "HueKit.framework"
68+ BlueprintName = "HueKit"
69+ ReferencedContainer = "container:HueKit.xcodeproj">
70+ </BuildableReference>
71+ </MacroExpansion>
72+ </ProfileAction>
73+ <AnalyzeAction
74+ buildConfiguration = "Debug">
75+ </AnalyzeAction>
76+ <ArchiveAction
77+ buildConfiguration = "Release"
78+ revealArchiveInOrganizer = "YES">
79+ </ArchiveAction>
80+</Scheme>
HueKit.xcworkspace/contents.xcworkspacedatanew file+10
@@ -0,0 +1,10 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<Workspace
3+ version = "1.0">
4+ <FileRef
5+ location = "group:Example/Example.xcodeproj">
6+ </FileRef>
7+ <FileRef
8+ location = "group:HueKit.xcodeproj">
9+ </FileRef>
10+</Workspace>
HueKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plistnew file+8
@@ -0,0 +1,8 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+<plist version="1.0">
4+<dict>
5+ <key>IDEDidComputeMac32BitWarning</key>
6+ <true/>
7+</dict>
8+</plist>
HueKit/Info.plist+1−1
@@ -15,7 +15,7 @@
1515 <key>CFBundlePackageType</key>
1616 <string>FMWK</string>
1717 <key>CFBundleShortVersionString</key>
18− <string>1.0</string>
18+ <string>1.0.1</string>
1919 <key>CFBundleVersion</key>
2020 <string>$(CURRENT_PROJECT_VERSION)</string>
2121 <key>NSPrincipalClass</key>
HueKit/Model/HSV.swift+1−1
@@ -9,7 +9,7 @@
99import Foundation
1010import CoreGraphics
1111
12−public struct HSV {
12+public struct HSV: Hashable {
1313 /// In degrees (range 0...360)
1414 public var h: CGFloat
1515
HueKit/Model/RGB.swift+1−1
@@ -9,7 +9,7 @@
99import Foundation
1010import CoreGraphics
1111
12−public struct RGB {
12+public struct RGB: Hashable {
1313 /// In range 0...1
1414 public var r: CGFloat
1515
HueKit/View/ColorBarPicker.swift+12−12
@@ -10,7 +10,7 @@ import Foundation
1010import UIKit
1111
1212@IBDesignable
13−public class ColorBarPicker: UIControl {
13+open class ColorBarPicker: UIControl {
1414
1515 private var isVertical: Bool = false {
1616 didSet {
@@ -33,7 +33,7 @@ public class ColorBarPicker: UIControl {
3333 private static let indicatorSizeActive = CGSize(width: 40.0, height: 40.0)
3434
3535 @IBInspectable
36− public var hue: CGFloat {
36+ open var hue: CGFloat {
3737 get {
3838 if isVertical {
3939 return 1.0 - value
@@ -62,7 +62,7 @@ public class ColorBarPicker: UIControl {
6262 }
6363 }
6464
65− private lazy var colorBarView: ColorBarView = {
65+ open lazy var colorBarView: ColorBarView = {
6666 return ColorBarView()
6767 }()
6868
@@ -112,7 +112,7 @@ public class ColorBarPicker: UIControl {
112112
113113 // MARK: - Drawing
114114
115− override public func layoutSubviews() {
115+ override open func layoutSubviews() {
116116
117117 if colorBarView.superview == nil {
118118
@@ -182,26 +182,26 @@ public class ColorBarPicker: UIControl {
182182 self.value = percent.pinned(between: 0, and: 1)
183183 }
184184
185− override public func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
185+ override open func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
186186 self.trackIndicator(with: touch)
187187
188188 growIndicator()
189189 return true
190190 }
191191
192− override public func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
192+ override open func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
193193 self.trackIndicator(with: touch)
194194
195195 return true
196196 }
197197
198− override public func endTracking(_ touch: UITouch?, with event: UIEvent?) {
198+ override open func endTracking(_ touch: UITouch?, with event: UIEvent?) {
199199 super.endTracking(touch, with: event)
200200
201201 shrinkIndicator()
202202 }
203203
204− override public func cancelTracking(with event: UIEvent?) {
204+ override open func cancelTracking(with event: UIEvent?) {
205205 super.cancelTracking(with: event)
206206
207207 shrinkIndicator()
@@ -250,7 +250,7 @@ public class ColorBarPicker: UIControl {
250250
251251 private let accessibilityInterval: CGFloat = 0.05
252252
253− public override var accessibilityTraits: UIAccessibilityTraits {
253+ open override var accessibilityTraits: UIAccessibilityTraits {
254254 get {
255255 var t = super.accessibilityTraits
256256
@@ -263,7 +263,7 @@ public class ColorBarPicker: UIControl {
263263 }
264264 }
265265
266− public override func accessibilityIncrement() {
266+ open override func accessibilityIncrement() {
267267
268268 var newValue = self.value + accessibilityInterval
269269
@@ -274,7 +274,7 @@ public class ColorBarPicker: UIControl {
274274 self.value = newValue
275275 }
276276
277− public override func accessibilityDecrement() {
277+ open override func accessibilityDecrement() {
278278
279279 var newValue = self.value - accessibilityInterval
280280
@@ -285,7 +285,7 @@ public class ColorBarPicker: UIControl {
285285 self.value = newValue
286286 }
287287
288− public override var accessibilityValue: String? {
288+ open override var accessibilityValue: String? {
289289 get {
290290 return String(format: "%d degrees hue", (self.value * 360.0))
291291 }
HueKit/View/ColorBarView.swift+2−2
@@ -10,7 +10,7 @@ import Foundation
1010import UIKit
1111
1212@IBDesignable
13−class ColorBarView: UIView {
13+open class ColorBarView: UIView {
1414
1515 private static func createContentImage() -> CGImage? {
1616
@@ -19,7 +19,7 @@ class ColorBarView: UIView {
1919 return HSBGen.createHSVBarContentImage(hsbComponent: .hue, hsv: hsv)
2020 }
2121
22− override func draw(_ rect: CGRect) {
22+ override open func draw(_ rect: CGRect) {
2323
2424 guard let context = UIGraphicsGetCurrentContext() else {
2525 return
HueKit/View/ColorIndicatorView.swift+5−4
@@ -10,10 +10,10 @@ import Foundation
1010import UIKit
1111
1212@IBDesignable
13−public class ColorIndicatorView: UIView {
13+open class ColorIndicatorView: UIView {
1414
1515 @IBInspectable
16− public var color: UIColor = .black {
16+ open var color: UIColor = .black {
1717 didSet {
1818
1919 if oldValue != color {
@@ -31,10 +31,11 @@ public class ColorIndicatorView: UIView {
3131 }
3232
3333 required public init?(coder aDecoder: NSCoder) {
34− fatalError("init(coder:) has not been implemented")
34+ super.init(coder: aDecoder)
35+
3536 }
3637
37− override public func draw(_ rect: CGRect) {
38+ override open func draw(_ rect: CGRect) {
3839
3940 guard let context = UIGraphicsGetCurrentContext() else {
4041 return
HueKit/View/ColorSquarePicker.swift+12−8
@@ -10,7 +10,7 @@ import Foundation
1010import UIKit
1111
1212@IBDesignable
13−public class ColorSquarePicker: UIControl {
13+open class ColorSquarePicker: UIControl {
1414
1515 private let contentInsetX: CGFloat = 20
1616 private let contentInsetY: CGFloat = 20
@@ -22,7 +22,7 @@ public class ColorSquarePicker: UIControl {
2222 return ColorSquareView()
2323 }()
2424
25− private lazy var indicator: ColorIndicatorView = {
25+ open lazy var indicator: ColorIndicatorView = {
2626
2727 let size = CGSize(width: self.indicatorSizeInactive, height: self.indicatorSizeInactive)
2828 let indicatorRect = CGRect(origin: .zero, size: size)
@@ -49,14 +49,18 @@ public class ColorSquarePicker: UIControl {
4949 }
5050 }
5151 }
52+
53+ public var color: UIColor {
54+ return UIColor(hue: hue, saturation: value.x, brightness: value.y, alpha: 1.0)
55+ }
5256
5357 private func setIndicatorColor() {
5458
5559 colorSquareView.hue = hue
56− indicator.color = UIColor(hue: hue, saturation: value.x, brightness: value.y, alpha: 1.0)
60+ indicator.color = color
5761 }
5862
59− public override func layoutSubviews() {
63+ open override func layoutSubviews() {
6064
6165 if colorSquareView.superview == nil {
6266
@@ -100,7 +104,7 @@ public class ColorSquarePicker: UIControl {
100104 self.value = touchValue
101105 }
102106
103− override public func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
107+ override open func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
104108
105109 self.trackIndicator(with: touch)
106110
@@ -109,20 +113,20 @@ public class ColorSquarePicker: UIControl {
109113 return true
110114 }
111115
112− override public func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
116+ override open func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
113117
114118 self.trackIndicator(with: touch)
115119
116120 return true
117121 }
118122
119− override public func endTracking(_ touch: UITouch?, with event: UIEvent?) {
123+ override open func endTracking(_ touch: UITouch?, with event: UIEvent?) {
120124 super.endTracking(touch, with: event)
121125
122126 shrinkIndicator()
123127 }
124128
125− override public func cancelTracking(with event: UIEvent?) {
129+ override open func cancelTracking(with event: UIEvent?) {
126130 super.cancelTracking(with: event)
127131
128132 shrinkIndicator()
HueKit/View/ColorSquareView.swift+4−4
@@ -9,15 +9,15 @@
99import UIKit
1010
1111@IBDesignable
12−class ColorSquareView: UIImageView {
12+open class ColorSquareView: UIImageView {
1313
1414 private var drawnHue: CGFloat = 0.0
1515
1616 @IBInspectable
17− var hue: CGFloat = 0.0 {
17+ open var hue: CGFloat = 0.0 {
1818 didSet {
19−
20− if abs(drawnHue - hue) <= 1e-10 {
19+
20+ if self.image != nil && abs(drawnHue - hue) <= 1e-10 {
2121 return
2222 }
2323
HueKit/View/SourceColorView.swift+8−8
@@ -10,10 +10,10 @@ import Foundation
1010import UIKit
1111
1212@IBDesignable
13−public class SourceColorView: UIControl {
13+open class SourceColorView: UIControl {
1414
1515 @IBInspectable
16− public var isTrackingInside: Bool = false {
16+ open var isTrackingInside: Bool = false {
1717 didSet {
1818 if oldValue != isTrackingInside {
1919 self.setNeedsDisplay()
@@ -22,7 +22,7 @@ public class SourceColorView: UIControl {
2222 }
2323
2424 @IBInspectable
25− public var dontShrinkWhenPressed: Bool = false {
25+ open var dontShrinkWhenPressed: Bool = false {
2626 didSet {
2727 if oldValue != dontShrinkWhenPressed {
2828 self.setNeedsDisplay()
@@ -30,7 +30,7 @@ public class SourceColorView: UIControl {
3030 }
3131 }
3232
33− public override func draw(_ rect: CGRect) {
33+ open override func draw(_ rect: CGRect) {
3434 super.draw(rect)
3535
3636 guard isEnabled && isTrackingInside && !dontShrinkWhenPressed else {
@@ -52,7 +52,7 @@ public class SourceColorView: UIControl {
5252
5353 // MARK: - UIControl overrides
5454
55− public override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
55+ open override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
5656
5757 guard self.isEnabled else {
5858 return false
@@ -63,7 +63,7 @@ public class SourceColorView: UIControl {
6363 return super.beginTracking(touch, with: event)
6464 }
6565
66− public override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
66+ open override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
6767
6868 let isTrackingInside = self.bounds.contains(touch.location(in: self))
6969
@@ -72,14 +72,14 @@ public class SourceColorView: UIControl {
7272 return super.continueTracking(touch, with: event)
7373 }
7474
75− public override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
75+ open override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
7676
7777 self.isTrackingInside = false
7878
7979 super.endTracking(touch, with: event)
8080 }
8181
82− public override func cancelTracking(with event: UIEvent?) {
82+ open override func cancelTracking(with event: UIEvent?) {
8383
8484 self.isTrackingInside = false
8585
LICENSE+1−1
@@ -1,6 +1,6 @@
11MIT License
22
3−Copyright (c) 2016 Louis D'hauwe
3+Copyright (c) 2018 Louis D'hauwe
44
55Permission is hereby granted, free of charge, to any person obtaining a copy
66of this software and associated documentation files (the "Software"), to deal
README.mdnew file+79
@@ -0,0 +1,79 @@
1+<p align="center">
2+<img src="readme-resources/hero@2x.png" style="max-height: 300px;" alt="HueKit for iOS">
3+</p>
4+
5+<p align="center">
6+<a href="https://travis-ci.org/louisdh/huekit"><img src="https://travis-ci.org/louisdh/huekit.svg?branch=master" style="max-height: 300px;" alt="Build Status"/></a>
7+<br>
8+<a href="https://developer.apple.com/swift/"><img src="https://img.shields.io/badge/Swift-4.1-orange.svg?style=flat" style="max-height: 300px;" alt="Swift"/></a>
9+<a href="https://cocoapods.org/pods/HueKit"><img src="https://img.shields.io/cocoapods/v/HueKit.svg" style="max-height: 300px;" alt="Pod Version"/></a>
10+<a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4bc51d.svg?style=flat" style="max-height: 300px;" alt="Carthage Compatible"/></a>
11+<img src="https://img.shields.io/badge/platform-iOS-lightgrey.svg" style="max-height: 300px;" alt="Platform: iOS">
12+<br>
13+<a href="http://twitter.com/LouisDhauwe"><img src="https://img.shields.io/badge/Twitter-@LouisDhauwe-blue.svg?style=flat" style="max-height: 300px;" alt="Twitter"/></a>
14+<a href="https://paypal.me/louisdhauwe"><img src="https://img.shields.io/badge/Donate-PayPal-green.svg?style=flat" alt="Donate via PayPal"/></a>
15+</p>
16+
17+<p align="center">
18+<img src="readme-resources/example.gif" style="max-height: 1480px;" alt="HueKit for iOS">
19+</p>
20+
21+
22+## About
23+HueKit is a UI framework for iOS that provides components and utilities for building color pickers. Since each app may want a custom color picker, the design of this framework is geared towards reusability and allows for great customization.
24+
25+### Components
26+All components are marked `open`, so they can be subclassed. Also, all components are marked `@IBDesignable`, so they can be previewed in Interface Builder. Components that provide user interaction are subclassed from `UIControl`, you can observe a change in value by using `@IBAction`.
27+
28+#### ColorBarPicker
29+![](readme-resources/components/ColorBarPicker.png)
30+
31+#### ColorBarView
32+![](readme-resources/components/ColorBarView.png)
33+
34+#### ColorIndicatorView
35+![](readme-resources/components/ColorIndicatorView.png)
36+
37+#### ColorSquarePicker
38+![](readme-resources/components/ColorSquarePicker.png)
39+
40+#### ColorSquareView
41+![](readme-resources/components/ColorSquareView.png)
42+
43+#### SourceColorView
44+![](readme-resources/components/SourceColorView.png)
45+
46+
47+## Installation
48+
49+### [CocoaPods](http://cocoapods.org)
50+
51+To install, add the following line to your ```Podfile```:
52+
53+```ruby
54+pod 'HueKit', '~> 1.0'
55+```
56+
57+### [Carthage](https://github.com/Carthage/Carthage)
58+To install, add the following line to your ```Cartfile```:
59+
60+```ruby
61+github "louisdh/huekit" ~> 1.0
62+```
63+Run ```carthage update``` to build the framework and drag the built ```HueKit.framework``` into your Xcode project.
64+
65+
66+
67+## Requirements
68+
69+* iOS 10.0+
70+* Xcode 9.3+
71+
72+## Todo
73+
74+- [ ] Add tests
75+- [ ] Add documentation
76+
77+## License
78+
79+This project is available under the MIT license. See the LICENSE file for more info.
readme-resources/components/ColorBarPicker.pngnew file

Binary file not shown.

readme-resources/components/ColorBarView.pngnew file

Binary file not shown.

readme-resources/components/ColorIndicatorView.pngnew file

Binary file not shown.

readme-resources/components/ColorSquarePicker.pngnew file

Binary file not shown.

readme-resources/components/ColorSquareView.pngnew file

Binary file not shown.

readme-resources/components/SourceColorView.pngnew file

Binary file not shown.

readme-resources/example.gifnew file

Binary file not shown.

readme-resources/hero@2x.pngnew file

Binary file not shown.