on master help sign in
.swift-version+1−1
since splitsnapshots
unifiedsplit
@@ -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 @@
150 BE5C1E0E1F3266B600B0080C /* Project object */ = {
150 BE5C1E0E1F3266B600B0080C /* Project object */ = {
151 isa = PBXProject;
151 isa = PBXProject;
152 attributes = {
152 attributes = {
153+ LastSwiftUpdateCheck = 0930;
153− LastUpgradeCheck = 0900;
154+ LastUpgradeCheck = 0930;
154 ORGANIZATIONNAME = "Silver Fox";
155 ORGANIZATIONNAME = "Silver Fox";
155 TargetAttributes = {
156 TargetAttributes = {
156 BE5C1E161F3266B600B0080C = {
157 BE5C1E161F3266B600B0080C = {
157 CreatedOnToolsVersion = 8.3.3;
158 CreatedOnToolsVersion = 8.3.3;
158− DevelopmentTeam = 6G5LMQ72D8;
159 LastSwiftMigration = 0900;
159 LastSwiftMigration = 0900;
160− ProvisioningStyle = Automatic;
160+ ProvisioningStyle = Manual;
161 };
161 };
162 };
162 };
163 };
163 };
@@ -167,6 +167,7 @@
167 hasScannedForEncodings = 0;
167 hasScannedForEncodings = 0;
168 knownRegions = (
168 knownRegions = (
169 en,
169 en,
170+ Base,
170 );
171 );
171 mainGroup = BE5C1E0D1F3266B600B0080C;
172 mainGroup = BE5C1E0D1F3266B600B0080C;
172 productRefGroup = BE5C1E181F3266B600B0080C /* Products */;
173 productRefGroup = BE5C1E181F3266B600B0080C /* Products */;
@@ -225,6 +226,7 @@
225 CLANG_WARN_BOOL_CONVERSION = YES;
226 CLANG_WARN_BOOL_CONVERSION = YES;
226 CLANG_WARN_COMMA = YES;
227 CLANG_WARN_COMMA = YES;
227 CLANG_WARN_CONSTANT_CONVERSION = YES;
228 CLANG_WARN_CONSTANT_CONVERSION = YES;
229+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
228 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
230 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
229 CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
231 CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
230 CLANG_WARN_EMPTY_BODY = YES;
232 CLANG_WARN_EMPTY_BODY = YES;
@@ -232,6 +234,7 @@
232 CLANG_WARN_INFINITE_RECURSION = YES;
234 CLANG_WARN_INFINITE_RECURSION = YES;
233 CLANG_WARN_INT_CONVERSION = YES;
235 CLANG_WARN_INT_CONVERSION = YES;
234 CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
236 CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
237+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
235 CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
238 CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
236 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
239 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
237 CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
240 CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -285,6 +288,7 @@
285 CLANG_WARN_BOOL_CONVERSION = YES;
288 CLANG_WARN_BOOL_CONVERSION = YES;
286 CLANG_WARN_COMMA = YES;
289 CLANG_WARN_COMMA = YES;
287 CLANG_WARN_CONSTANT_CONVERSION = YES;
290 CLANG_WARN_CONSTANT_CONVERSION = YES;
291+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
288 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
292 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
289 CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
293 CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
290 CLANG_WARN_EMPTY_BODY = YES;
294 CLANG_WARN_EMPTY_BODY = YES;
@@ -292,6 +296,7 @@
292 CLANG_WARN_INFINITE_RECURSION = YES;
296 CLANG_WARN_INFINITE_RECURSION = YES;
293 CLANG_WARN_INT_CONVERSION = YES;
297 CLANG_WARN_INT_CONVERSION = YES;
294 CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
298 CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
299+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
295 CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
300 CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
296 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
301 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
297 CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
302 CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -329,9 +334,10 @@
329 buildSettings = {
334 buildSettings = {
330 CLANG_ENABLE_MODULES = YES;
335 CLANG_ENABLE_MODULES = YES;
331 CODE_SIGN_IDENTITY = "";
336 CODE_SIGN_IDENTITY = "";
337+ CODE_SIGN_STYLE = Manual;
332 DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
338 DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
333 DEFINES_MODULE = YES;
339 DEFINES_MODULE = YES;
334− DEVELOPMENT_TEAM = 6G5LMQ72D8;
340+ DEVELOPMENT_TEAM = "";
335 DYLIB_COMPATIBILITY_VERSION = 1;
341 DYLIB_COMPATIBILITY_VERSION = 1;
336 DYLIB_CURRENT_VERSION = 1;
342 DYLIB_CURRENT_VERSION = 1;
337 DYLIB_INSTALL_NAME_BASE = "@rpath";
343 DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -341,6 +347,7 @@
341 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
347 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
342 PRODUCT_BUNDLE_IDENTIFIER = be.silverfox.HueKit;
348 PRODUCT_BUNDLE_IDENTIFIER = be.silverfox.HueKit;
343 PRODUCT_NAME = "$(TARGET_NAME)";
349 PRODUCT_NAME = "$(TARGET_NAME)";
350+ PROVISIONING_PROFILE_SPECIFIER = "";
344 SKIP_INSTALL = YES;
351 SKIP_INSTALL = YES;
345 SWIFT_OPTIMIZATION_LEVEL = "-Onone";
352 SWIFT_OPTIMIZATION_LEVEL = "-Onone";
346 SWIFT_SWIFT3_OBJC_INFERENCE = Default;
353 SWIFT_SWIFT3_OBJC_INFERENCE = Default;
@@ -353,8 +360,9 @@
353 buildSettings = {
360 buildSettings = {
354 CLANG_ENABLE_MODULES = YES;
361 CLANG_ENABLE_MODULES = YES;
355 CODE_SIGN_IDENTITY = "";
362 CODE_SIGN_IDENTITY = "";
363+ CODE_SIGN_STYLE = Manual;
356 DEFINES_MODULE = YES;
364 DEFINES_MODULE = YES;
357− DEVELOPMENT_TEAM = 6G5LMQ72D8;
365+ DEVELOPMENT_TEAM = "";
358 DYLIB_COMPATIBILITY_VERSION = 1;
366 DYLIB_COMPATIBILITY_VERSION = 1;
359 DYLIB_CURRENT_VERSION = 1;
367 DYLIB_CURRENT_VERSION = 1;
360 DYLIB_INSTALL_NAME_BASE = "@rpath";
368 DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -364,6 +372,7 @@
364 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
372 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
365 PRODUCT_BUNDLE_IDENTIFIER = be.silverfox.HueKit;
373 PRODUCT_BUNDLE_IDENTIFIER = be.silverfox.HueKit;
366 PRODUCT_NAME = "$(TARGET_NAME)";
374 PRODUCT_NAME = "$(TARGET_NAME)";
375+ PROVISIONING_PROFILE_SPECIFIER = "";
367 SKIP_INSTALL = YES;
376 SKIP_INSTALL = YES;
368 SWIFT_SWIFT3_OBJC_INFERENCE = Default;
377 SWIFT_SWIFT3_OBJC_INFERENCE = Default;
369 SWIFT_VERSION = 4.0;
378 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 @@
15 <key>CFBundlePackageType</key>
15 <key>CFBundlePackageType</key>
16 <string>FMWK</string>
16 <string>FMWK</string>
17 <key>CFBundleShortVersionString</key>
17 <key>CFBundleShortVersionString</key>
18− <string>1.0</string>
18+ <string>1.0.1</string>
19 <key>CFBundleVersion</key>
19 <key>CFBundleVersion</key>
20 <string>$(CURRENT_PROJECT_VERSION)</string>
20 <string>$(CURRENT_PROJECT_VERSION)</string>
21 <key>NSPrincipalClass</key>
21 <key>NSPrincipalClass</key>
HueKit/Model/HSV.swift+1−1
@@ -9,7 +9,7 @@
9import Foundation
9import Foundation
10import CoreGraphics
10import CoreGraphics
11
11
12−public struct HSV {
12+public struct HSV: Hashable {
13 /// In degrees (range 0...360)
13 /// In degrees (range 0...360)
14 public var h: CGFloat
14 public var h: CGFloat
15
15
HueKit/Model/RGB.swift+1−1
@@ -9,7 +9,7 @@
9import Foundation
9import Foundation
10import CoreGraphics
10import CoreGraphics
11
11
12−public struct RGB {
12+public struct RGB: Hashable {
13 /// In range 0...1
13 /// In range 0...1
14 public var r: CGFloat
14 public var r: CGFloat
15
15
HueKit/View/ColorBarPicker.swift+12−12
@@ -10,7 +10,7 @@ import Foundation
10import UIKit
10import UIKit
11
11
12@IBDesignable
12@IBDesignable
13−public class ColorBarPicker: UIControl {
13+open class ColorBarPicker: UIControl {
14
14
15 private var isVertical: Bool = false {
15 private var isVertical: Bool = false {
16 didSet {
16 didSet {
@@ -33,7 +33,7 @@ public class ColorBarPicker: UIControl {
33 private static let indicatorSizeActive = CGSize(width: 40.0, height: 40.0)
33 private static let indicatorSizeActive = CGSize(width: 40.0, height: 40.0)
34
34
35 @IBInspectable
35 @IBInspectable
36− public var hue: CGFloat {
36+ open var hue: CGFloat {
37 get {
37 get {
38 if isVertical {
38 if isVertical {
39 return 1.0 - value
39 return 1.0 - value
@@ -62,7 +62,7 @@ public class ColorBarPicker: UIControl {
62 }
62 }
63 }
63 }
64
64
65− private lazy var colorBarView: ColorBarView = {
65+ open lazy var colorBarView: ColorBarView = {
66 return ColorBarView()
66 return ColorBarView()
67 }()
67 }()
68
68
@@ -112,7 +112,7 @@ public class ColorBarPicker: UIControl {
112
112
113 // MARK: - Drawing
113 // MARK: - Drawing
114
114
115− override public func layoutSubviews() {
115+ override open func layoutSubviews() {
116
116
117 if colorBarView.superview == nil {
117 if colorBarView.superview == nil {
118
118
@@ -182,26 +182,26 @@ public class ColorBarPicker: UIControl {
182 self.value = percent.pinned(between: 0, and: 1)
182 self.value = percent.pinned(between: 0, and: 1)
183 }
183 }
184
184
185− override public func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
185+ override open func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
186 self.trackIndicator(with: touch)
186 self.trackIndicator(with: touch)
187
187
188 growIndicator()
188 growIndicator()
189 return true
189 return true
190 }
190 }
191
191
192− override public func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
192+ override open func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
193 self.trackIndicator(with: touch)
193 self.trackIndicator(with: touch)
194
194
195 return true
195 return true
196 }
196 }
197
197
198− override public func endTracking(_ touch: UITouch?, with event: UIEvent?) {
198+ override open func endTracking(_ touch: UITouch?, with event: UIEvent?) {
199 super.endTracking(touch, with: event)
199 super.endTracking(touch, with: event)
200
200
201 shrinkIndicator()
201 shrinkIndicator()
202 }
202 }
203
203
204− override public func cancelTracking(with event: UIEvent?) {
204+ override open func cancelTracking(with event: UIEvent?) {
205 super.cancelTracking(with: event)
205 super.cancelTracking(with: event)
206
206
207 shrinkIndicator()
207 shrinkIndicator()
@@ -250,7 +250,7 @@ public class ColorBarPicker: UIControl {
250
250
251 private let accessibilityInterval: CGFloat = 0.05
251 private let accessibilityInterval: CGFloat = 0.05
252
252
253− public override var accessibilityTraits: UIAccessibilityTraits {
253+ open override var accessibilityTraits: UIAccessibilityTraits {
254 get {
254 get {
255 var t = super.accessibilityTraits
255 var t = super.accessibilityTraits
256
256
@@ -263,7 +263,7 @@ public class ColorBarPicker: UIControl {
263 }
263 }
264 }
264 }
265
265
266− public override func accessibilityIncrement() {
266+ open override func accessibilityIncrement() {
267
267
268 var newValue = self.value + accessibilityInterval
268 var newValue = self.value + accessibilityInterval
269
269
@@ -274,7 +274,7 @@ public class ColorBarPicker: UIControl {
274 self.value = newValue
274 self.value = newValue
275 }
275 }
276
276
277− public override func accessibilityDecrement() {
277+ open override func accessibilityDecrement() {
278
278
279 var newValue = self.value - accessibilityInterval
279 var newValue = self.value - accessibilityInterval
280
280
@@ -285,7 +285,7 @@ public class ColorBarPicker: UIControl {
285 self.value = newValue
285 self.value = newValue
286 }
286 }
287
287
288− public override var accessibilityValue: String? {
288+ open override var accessibilityValue: String? {
289 get {
289 get {
290 return String(format: "%d degrees hue", (self.value * 360.0))
290 return String(format: "%d degrees hue", (self.value * 360.0))
291 }
291 }
HueKit/View/ColorBarView.swift+2−2
@@ -10,7 +10,7 @@ import Foundation
10import UIKit
10import UIKit
11
11
12@IBDesignable
12@IBDesignable
13−class ColorBarView: UIView {
13+open class ColorBarView: UIView {
14
14
15 private static func createContentImage() -> CGImage? {
15 private static func createContentImage() -> CGImage? {
16
16
@@ -19,7 +19,7 @@ class ColorBarView: UIView {
19 return HSBGen.createHSVBarContentImage(hsbComponent: .hue, hsv: hsv)
19 return HSBGen.createHSVBarContentImage(hsbComponent: .hue, hsv: hsv)
20 }
20 }
21
21
22− override func draw(_ rect: CGRect) {
22+ override open func draw(_ rect: CGRect) {
23
23
24 guard let context = UIGraphicsGetCurrentContext() else {
24 guard let context = UIGraphicsGetCurrentContext() else {
25 return
25 return
HueKit/View/ColorIndicatorView.swift+5−4
@@ -10,10 +10,10 @@ import Foundation
10import UIKit
10import UIKit
11
11
12@IBDesignable
12@IBDesignable
13−public class ColorIndicatorView: UIView {
13+open class ColorIndicatorView: UIView {
14
14
15 @IBInspectable
15 @IBInspectable
16− public var color: UIColor = .black {
16+ open var color: UIColor = .black {
17 didSet {
17 didSet {
18
18
19 if oldValue != color {
19 if oldValue != color {
@@ -31,10 +31,11 @@ public class ColorIndicatorView: UIView {
31 }
31 }
32
32
33 required public init?(coder aDecoder: NSCoder) {
33 required public init?(coder aDecoder: NSCoder) {
34− fatalError("init(coder:) has not been implemented")
34+ super.init(coder: aDecoder)
35+
35 }
36 }
36
37
37− override public func draw(_ rect: CGRect) {
38+ override open func draw(_ rect: CGRect) {
38
39
39 guard let context = UIGraphicsGetCurrentContext() else {
40 guard let context = UIGraphicsGetCurrentContext() else {
40 return
41 return
HueKit/View/ColorSquarePicker.swift+7−7
@@ -10,7 +10,7 @@ import Foundation
10import UIKit
10import UIKit
11
11
12@IBDesignable
12@IBDesignable
13−public class ColorSquarePicker: UIControl {
13+open class ColorSquarePicker: UIControl {
14
14
15 private let contentInsetX: CGFloat = 20
15 private let contentInsetX: CGFloat = 20
16 private let contentInsetY: CGFloat = 20
16 private let contentInsetY: CGFloat = 20
@@ -22,7 +22,7 @@ public class ColorSquarePicker: UIControl {
22 return ColorSquareView()
22 return ColorSquareView()
23 }()
23 }()
24
24
25− private lazy var indicator: ColorIndicatorView = {
25+ open lazy var indicator: ColorIndicatorView = {
26
26
27 let size = CGSize(width: self.indicatorSizeInactive, height: self.indicatorSizeInactive)
27 let size = CGSize(width: self.indicatorSizeInactive, height: self.indicatorSizeInactive)
28 let indicatorRect = CGRect(origin: .zero, size: size)
28 let indicatorRect = CGRect(origin: .zero, size: size)
@@ -60,7 +60,7 @@ public class ColorSquarePicker: UIControl {
60 indicator.color = color
60 indicator.color = color
61 }
61 }
62
62
63− public override func layoutSubviews() {
63+ open override func layoutSubviews() {
64
64
65 if colorSquareView.superview == nil {
65 if colorSquareView.superview == nil {
66
66
@@ -104,7 +104,7 @@ public class ColorSquarePicker: UIControl {
104 self.value = touchValue
104 self.value = touchValue
105 }
105 }
106
106
107− override public func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
107+ override open func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
108
108
109 self.trackIndicator(with: touch)
109 self.trackIndicator(with: touch)
110
110
@@ -113,20 +113,20 @@ public class ColorSquarePicker: UIControl {
113 return true
113 return true
114 }
114 }
115
115
116− override public func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
116+ override open func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
117
117
118 self.trackIndicator(with: touch)
118 self.trackIndicator(with: touch)
119
119
120 return true
120 return true
121 }
121 }
122
122
123− override public func endTracking(_ touch: UITouch?, with event: UIEvent?) {
123+ override open func endTracking(_ touch: UITouch?, with event: UIEvent?) {
124 super.endTracking(touch, with: event)
124 super.endTracking(touch, with: event)
125
125
126 shrinkIndicator()
126 shrinkIndicator()
127 }
127 }
128
128
129− override public func cancelTracking(with event: UIEvent?) {
129+ override open func cancelTracking(with event: UIEvent?) {
130 super.cancelTracking(with: event)
130 super.cancelTracking(with: event)
131
131
132 shrinkIndicator()
132 shrinkIndicator()
HueKit/View/ColorSquareView.swift+4−4
@@ -9,15 +9,15 @@
9import UIKit
9import UIKit
10
10
11@IBDesignable
11@IBDesignable
12−class ColorSquareView: UIImageView {
12+open class ColorSquareView: UIImageView {
13
13
14 private var drawnHue: CGFloat = 0.0
14 private var drawnHue: CGFloat = 0.0
15
15
16 @IBInspectable
16 @IBInspectable
17− var hue: CGFloat = 0.0 {
17+ open var hue: CGFloat = 0.0 {
18 didSet {
18 didSet {
19−
19+
20− if abs(drawnHue - hue) <= 1e-10 {
20+ if self.image != nil && abs(drawnHue - hue) <= 1e-10 {
21 return
21 return
22 }
22 }
23
23
HueKit/View/SourceColorView.swift+8−8
@@ -10,10 +10,10 @@ import Foundation
10import UIKit
10import UIKit
11
11
12@IBDesignable
12@IBDesignable
13−public class SourceColorView: UIControl {
13+open class SourceColorView: UIControl {
14
14
15 @IBInspectable
15 @IBInspectable
16− public var isTrackingInside: Bool = false {
16+ open var isTrackingInside: Bool = false {
17 didSet {
17 didSet {
18 if oldValue != isTrackingInside {
18 if oldValue != isTrackingInside {
19 self.setNeedsDisplay()
19 self.setNeedsDisplay()
@@ -22,7 +22,7 @@ public class SourceColorView: UIControl {
22 }
22 }
23
23
24 @IBInspectable
24 @IBInspectable
25− public var dontShrinkWhenPressed: Bool = false {
25+ open var dontShrinkWhenPressed: Bool = false {
26 didSet {
26 didSet {
27 if oldValue != dontShrinkWhenPressed {
27 if oldValue != dontShrinkWhenPressed {
28 self.setNeedsDisplay()
28 self.setNeedsDisplay()
@@ -30,7 +30,7 @@ public class SourceColorView: UIControl {
30 }
30 }
31 }
31 }
32
32
33− public override func draw(_ rect: CGRect) {
33+ open override func draw(_ rect: CGRect) {
34 super.draw(rect)
34 super.draw(rect)
35
35
36 guard isEnabled && isTrackingInside && !dontShrinkWhenPressed else {
36 guard isEnabled && isTrackingInside && !dontShrinkWhenPressed else {
@@ -52,7 +52,7 @@ public class SourceColorView: UIControl {
52
52
53 // MARK: - UIControl overrides
53 // MARK: - UIControl overrides
54
54
55− public override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
55+ open override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
56
56
57 guard self.isEnabled else {
57 guard self.isEnabled else {
58 return false
58 return false
@@ -63,7 +63,7 @@ public class SourceColorView: UIControl {
63 return super.beginTracking(touch, with: event)
63 return super.beginTracking(touch, with: event)
64 }
64 }
65
65
66− public override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
66+ open override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
67
67
68 let isTrackingInside = self.bounds.contains(touch.location(in: self))
68 let isTrackingInside = self.bounds.contains(touch.location(in: self))
69
69
@@ -72,14 +72,14 @@ public class SourceColorView: UIControl {
72 return super.continueTracking(touch, with: event)
72 return super.continueTracking(touch, with: event)
73 }
73 }
74
74
75− public override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
75+ open override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
76
76
77 self.isTrackingInside = false
77 self.isTrackingInside = false
78
78
79 super.endTracking(touch, with: event)
79 super.endTracking(touch, with: event)
80 }
80 }
81
81
82− public override func cancelTracking(with event: UIEvent?) {
82+ open override func cancelTracking(with event: UIEvent?) {
83
83
84 self.isTrackingInside = false
84 self.isTrackingInside = false
85
85
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.