diff --git a/.travis.yml b/.travis.yml index 61fea0c..ffc65e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: objective-c -osx_image: xcode7.2 -xcode_project: HexColors.xcodeproj -xcode_scheme: HexColors -xcode_sdk: iphonesimulator9.2 +osx_image: xcode8.2 +script: + - xcodebuild test -scheme HexColors-iOS-Tests -sdk iphonesimulator -destination 'platform=iOS Simulator,id=79C525D3-2383-4201-AC3A-81810F9F4E03' +after_success: + - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 71fe16e..f035f64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,16 @@ All notable changes to this project will be documented in this file. `HexColors` adheres to [Semantic Versioning](http://semver.org/). --- +## [5.0.0] (https://github.com/mRs-/HexColors/tree/5.0.0) +* Completetly rewritten in Swift 3.0 +* hx_colorWithHexString / hx_colorWithHexRGBAString are not working any more +* breaking API-Changes +* Create UI/NSColor now with `UIColor("#FF00FF")` or `NSColor("#00FFFF")` +* For Objective-C support switch to Version [4.0.0] (https://github.com/mRs-/HexColors/tree/5.0.0) + ## [4.0.0] (https://github.com/mRs-/HexColors/tree/4.0.0) * depricating hx_colorWithHexString use hx_colorWithHexRGBAString instead -** we moved from hx_colorWithHexString to show you where we are heading in the future. Most of you are not using the alpha component of this so we are moving this to colorWithHexRGBA, because most browsers are doing the same here. It's just natural to follow this through the library. We will drop this in colorWithHexString in 5.0.0 +** we moved from hx_colorWithHexString to show you where we are heading in the future. Most of you are not using the alpha component of this so we are moving this to colorWithHexRGBA, because most browsers are doing the same here. It's just natural to follow this through the library. ## [3.1.1] (https://github.com/mRs-/HexColors/tree/3.1.1) * added cocoadocs diff --git a/Classes/HexColors.h b/Classes/HexColors.h deleted file mode 100755 index 75a8395..0000000 --- a/Classes/HexColors.h +++ /dev/null @@ -1,100 +0,0 @@ -// -// HexColor.h -// -// Created by Marius Landwehr on 02.12.12. -// The MIT License (MIT) -// Copyright (c) 2013 Marius Landwehr marius.landwehr@gmail.com -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#import "TargetConditionals.h" - -#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR - #import - #define HXColor UIColor -#else - #import - #define HXColor NSColor -#endif - -@interface HXColor (HexColorAddition) - -/** - Creates a UIColor or NSColor from a HexString like #fff, #ffff, #ff00aa or #ff00aaee. - With complete support for short hand hex values, short hand with short alpha value, full - hex values and full hex values with alpha. - - @param hexString NSString hex string for color generation - @return UIColor / NSColor or nil - */ -+ (nullable HXColor *)hx_colorWithHexString:(nonnull NSString *)hexString __attribute__ ((deprecated("Use '-hx_colorWithHexRGBAString' instead."))); - -/** - Creates a UIColor or NSColor from a HexString like #fff, #ffff, #ff00aa or #ff00aaee. - With complete support for short hand hex values, short hand with short alpha value, full - hex values and full hex values with alpha. To include alpha with the hex string append the values - at the end of the string. - - @param hexString NSString hex string for color generation - @return UIColor / NSColor or nil - */ -+ (nullable HXColor *)hx_colorWithHexRGBAString:(nonnull NSString *)hexString; - -/** - Same implementation as hx_colorWithHexString but you can hand in a normal alpha value from 0 to 1 - - @param hexString NSString hex string for color generation - @param alpha CGFloat from 0 to 1 - @return UIColor / NSColor or nil - */ -+ (nullable HXColor *)hx_colorWithHexString:(nonnull NSString *)hexString alpha:(CGFloat)alpha __attribute__ ((deprecated("Use '-hx_colorWithHexRGBAString :alpha' instead."))); - -/** - Same implementation as hx_colorWithHexRGBAString but you can hand in a normal alpha value from 0 to 1 - - @param hexString NSString hex string for color generation - @param alpha CGFloat from 0 to 1 - @return UIColor / NSColor or nil - */ -+ (nullable HXColor *)hx_colorWithHexRGBAString:(nonnull NSString *)hexString alpha:(CGFloat)alpha; - -/** - Don't like to devide by 255 to get a value between 0 to 1 for creating a color? This helps you create - a UIColor without the hassle, which leads to cleaner code - - @param red NSInteger hand in a value for red between 0 and 255 - @param green NSInteger hand in a value for green between 0 and 255 - @param blue NSInteger hand in a value for blue between 0 and 255 - @return UIColor / NSColor - */ -+ (nonnull HXColor *)hx_colorWith8BitRed:(NSInteger)red green:(NSInteger)green blue:(NSInteger)blue; - -/** - Same implementation as hx_colorWith8BitRed:green:blue but you can hand in a normal alpha value from 0 to 1 - - @param red NSInteger hand in a value for red between 0 and 255 - @param green NSInteger hand in a value for green between 0 and 255 - @param blue NSInteger hand in a value for blue between 0 and 255 - @param alpha CGFloat from 0 to 1 - @return UIColor / NSColor - */ -+ (nonnull HXColor *)hx_colorWith8BitRed:(NSInteger)red green:(NSInteger)green blue:(NSInteger)blue alpha:(CGFloat)alpha; - -@end - - -@interface NSString (hx_StringTansformer) - -/** - Checks for a short hexString like #fff and transform it to a long hexstring like #ffffff - - @return hexString NSString a normal hexString with the length of 7 characters like #ffffff or the initial string - */ -- (nonnull NSString *)hx_hexStringTransformFromThreeCharacters; - -@end \ No newline at end of file diff --git a/Classes/HexColors.m b/Classes/HexColors.m deleted file mode 100755 index 66cabda..0000000 --- a/Classes/HexColors.m +++ /dev/null @@ -1,173 +0,0 @@ -// -// HexColor.m -// -// Created by Marius Landwehr on 02.12.12. -// The MIT License (MIT) -// Copyright (c) 2013 Marius Landwehr marius.landwehr@gmail.com -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#import "HexColors.h" - -@implementation HXColor (HexColorAddition) - -+ (HXColor *)hx_colorWithHexString:(NSString *)hexString -{ - return [[self class] hx_colorWithHexString:hexString alpha:1.0]; -} - -+ (HXColor *)hx_colorWithHexRGBAString:(NSString *)hexString -{ - return [[self class] hx_colorWithHexRGBAString:hexString alpha:1.0]; -} - -+ (HXColor *)hx_colorWithHexRGBAString:(NSString *)hexString alpha:(CGFloat)alpha -{ - // We found an empty string, we are returning nothing - if (hexString.length == 0) { - return nil; - } - - // Check for hash and add the missing hash - if('#' != [hexString characterAtIndex:0]) { - hexString = [NSString stringWithFormat:@"#%@", hexString]; - } - - // returning no object on wrong alpha values - NSArray *validHexStringLengths = @[@4, @5, @7, @9]; - NSNumber *hexStringLengthNumber = [NSNumber numberWithUnsignedInteger:hexString.length]; - if ([validHexStringLengths indexOfObject:hexStringLengthNumber] == NSNotFound) { - return nil; - } - - // if the hex string is 5 or 9 we are ignoring the alpha value and we are using the value from the hex string instead - CGFloat handedInAlpha = alpha; - if (5 == hexString.length || 9 == hexString.length) { - NSString *alphaHex; - if (5 == hexString.length) { - alphaHex = [hexString substringWithRange:NSMakeRange(4, 1)]; - } else { - alphaHex = [hexString substringWithRange:NSMakeRange(7, 2)]; - } - if (1 == alphaHex.length) alphaHex = [NSString stringWithFormat:@"%@%@", alphaHex, alphaHex]; - //hexString = [NSString stringWithFormat:@"#%@", [hexString substringFromIndex:9 == hexString.length ? 7 : 3]]; - hexString = [NSString stringWithFormat:@"#%@", [hexString substringWithRange:NSMakeRange(1, 9 == hexString.length ? 6 : 3)]]; - unsigned alpha_u = [[self class] hx_hexValueToUnsigned:alphaHex]; - handedInAlpha = ((CGFloat) alpha_u) / 255.0; - } - - // check for 3 character HexStrings - hexString = [hexString hx_hexStringTransformFromThreeCharacters]; - - NSString *redHex = [NSString stringWithFormat:@"0x%@", [hexString substringWithRange:NSMakeRange(1, 2)]]; - unsigned redInt = [[self class] hx_hexValueToUnsigned:redHex]; - - NSString *greenHex = [NSString stringWithFormat:@"0x%@", [hexString substringWithRange:NSMakeRange(3, 2)]]; - unsigned greenInt = [[self class] hx_hexValueToUnsigned:greenHex]; - - NSString *blueHex = [NSString stringWithFormat:@"0x%@", [hexString substringWithRange:NSMakeRange(5, 2)]]; - unsigned blueInt = [[self class] hx_hexValueToUnsigned:blueHex]; - - HXColor *color = [HXColor hx_colorWith8BitRed:redInt green:greenInt blue:blueInt alpha:handedInAlpha]; - - return color; -} - -+ (HXColor *)hx_colorWithHexString:(NSString *)hexString alpha:(CGFloat)alpha -{ - // We found an empty string, we are returning nothing - if (hexString.length == 0) { - return nil; - } - - // Check for hash and add the missing hash - if('#' != [hexString characterAtIndex:0]) { - hexString = [NSString stringWithFormat:@"#%@", hexString]; - } - - // returning no object on wrong alpha values - NSArray *validHexStringLengths = @[@4, @5, @7, @9]; - NSNumber *hexStringLengthNumber = [NSNumber numberWithUnsignedInteger:hexString.length]; - if ([validHexStringLengths indexOfObject:hexStringLengthNumber] == NSNotFound) { - return nil; - } - - // if the hex string is 5 or 9 we are ignoring the alpha value and we are using the value from the hex string instead - CGFloat handedInAlpha = alpha; - if (5 == hexString.length || 9 == hexString.length) { - NSString * alphaHex = [hexString substringWithRange:NSMakeRange(1, 9 == hexString.length ? 2 : 1)]; - if (1 == alphaHex.length) alphaHex = [NSString stringWithFormat:@"%@%@", alphaHex, alphaHex]; - hexString = [NSString stringWithFormat:@"#%@", [hexString substringFromIndex:9 == hexString.length ? 3 : 2]]; - unsigned alpha_u = [[self class] hx_hexValueToUnsigned:alphaHex]; - handedInAlpha = ((CGFloat) alpha_u) / 255.0; - } - - // check for 3 character HexStrings - hexString = [hexString hx_hexStringTransformFromThreeCharacters]; - - NSString *redHex = [NSString stringWithFormat:@"0x%@", [hexString substringWithRange:NSMakeRange(1, 2)]]; - unsigned redInt = [[self class] hx_hexValueToUnsigned:redHex]; - - NSString *greenHex = [NSString stringWithFormat:@"0x%@", [hexString substringWithRange:NSMakeRange(3, 2)]]; - unsigned greenInt = [[self class] hx_hexValueToUnsigned:greenHex]; - - NSString *blueHex = [NSString stringWithFormat:@"0x%@", [hexString substringWithRange:NSMakeRange(5, 2)]]; - unsigned blueInt = [[self class] hx_hexValueToUnsigned:blueHex]; - - HXColor *color = [HXColor hx_colorWith8BitRed:redInt green:greenInt blue:blueInt alpha:handedInAlpha]; - - return color; -} - -+ (HXColor *)hx_colorWith8BitRed:(NSInteger)red green:(NSInteger)green blue:(NSInteger)blue -{ - return [[self class] hx_colorWith8BitRed:red green:green blue:blue alpha:1.0]; -} - -+ (HXColor *)hx_colorWith8BitRed:(NSInteger)red green:(NSInteger)green blue:(NSInteger)blue alpha:(CGFloat)alpha -{ - HXColor *color = nil; -#if (TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE) - color = [HXColor colorWithRed:(float)red/255 green:(float)green/255 blue:(float)blue/255 alpha:alpha]; -#else - color = [HXColor colorWithCalibratedRed:(float)red/255 green:(float)green/255 blue:(float)blue/255 alpha:alpha]; -#endif - - return color; -} - -+ (unsigned)hx_hexValueToUnsigned:(NSString *)hexValue -{ - unsigned value = 0; - - NSScanner *hexValueScanner = [NSScanner scannerWithString:hexValue]; - [hexValueScanner scanHexInt:&value]; - - return value; -} - - -@end - -@implementation NSString (hx_StringTansformer) - -- (NSString *)hx_hexStringTransformFromThreeCharacters; -{ - if(self.length == 4) - { - NSString * hexString = [NSString stringWithFormat:@"#%1$c%1$c%2$c%2$c%3$c%3$c", - [self characterAtIndex:1], - [self characterAtIndex:2], - [self characterAtIndex:3]]; - return hexString; - } - - return self; -} - -@end diff --git a/Example/HexColor Examples.xcodeproj/project.pbxproj b/Example/HexColor Examples.xcodeproj/project.pbxproj deleted file mode 100644 index b44f20c..0000000 --- a/Example/HexColor Examples.xcodeproj/project.pbxproj +++ /dev/null @@ -1,311 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 2DACEC9E1A794CA900FEC3CE /* HexColors.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DACEC9D1A794CA900FEC3CE /* HexColors.m */; }; - 6DD2094317FEBB86000B398E /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6DD2094217FEBB86000B398E /* Images.xcassets */; }; - 8E2D283B174BEDA500B30576 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E2D283A174BEDA500B30576 /* UIKit.framework */; }; - 8E2D283D174BEDA500B30576 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E2D283C174BEDA500B30576 /* Foundation.framework */; }; - 8E2D283F174BEDA500B30576 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E2D283E174BEDA500B30576 /* CoreGraphics.framework */; }; - 8E2D2845174BEDA500B30576 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8E2D2843174BEDA500B30576 /* InfoPlist.strings */; }; - 8E2D2847174BEDA500B30576 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E2D2846174BEDA500B30576 /* main.m */; }; - 8E2D284B174BEDA500B30576 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E2D284A174BEDA500B30576 /* AppDelegate.m */; }; - 8E2D285E174BEE1900B30576 /* HexColorExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E2D285C174BEE1900B30576 /* HexColorExampleViewController.m */; }; - 8E2D285F174BEE1900B30576 /* HexColorExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8E2D285D174BEE1900B30576 /* HexColorExampleViewController.xib */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 2DACEC9C1A794CA900FEC3CE /* HexColors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HexColors.h; sourceTree = ""; }; - 2DACEC9D1A794CA900FEC3CE /* HexColors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HexColors.m; sourceTree = ""; }; - 6DD2094217FEBB86000B398E /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 8E2D2837174BEDA500B30576 /* HexColor Examples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "HexColor Examples.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 8E2D283A174BEDA500B30576 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 8E2D283C174BEDA500B30576 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 8E2D283E174BEDA500B30576 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 8E2D2842174BEDA500B30576 /* HexColor Examples-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "HexColor Examples-Info.plist"; sourceTree = ""; }; - 8E2D2844174BEDA500B30576 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 8E2D2846174BEDA500B30576 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 8E2D2848174BEDA500B30576 /* HexColor Examples-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "HexColor Examples-Prefix.pch"; sourceTree = ""; }; - 8E2D2849174BEDA500B30576 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 8E2D284A174BEDA500B30576 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 8E2D285B174BEE1900B30576 /* HexColorExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HexColorExampleViewController.h; sourceTree = ""; }; - 8E2D285C174BEE1900B30576 /* HexColorExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HexColorExampleViewController.m; sourceTree = ""; }; - 8E2D285D174BEE1900B30576 /* HexColorExampleViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HexColorExampleViewController.xib; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8E2D2834174BEDA500B30576 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8E2D283B174BEDA500B30576 /* UIKit.framework in Frameworks */, - 8E2D283D174BEDA500B30576 /* Foundation.framework in Frameworks */, - 8E2D283F174BEDA500B30576 /* CoreGraphics.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 2DACEC9B1A794CA900FEC3CE /* Classes */ = { - isa = PBXGroup; - children = ( - 2DACEC9C1A794CA900FEC3CE /* HexColors.h */, - 2DACEC9D1A794CA900FEC3CE /* HexColors.m */, - ); - name = Classes; - path = ../Classes; - sourceTree = ""; - }; - 8E2D282E174BEDA500B30576 = { - isa = PBXGroup; - children = ( - 2DACEC9B1A794CA900FEC3CE /* Classes */, - 8E2D2840174BEDA500B30576 /* HexColor Examples */, - 8E2D2839174BEDA500B30576 /* Frameworks */, - 8E2D2838174BEDA500B30576 /* Products */, - ); - sourceTree = ""; - }; - 8E2D2838174BEDA500B30576 /* Products */ = { - isa = PBXGroup; - children = ( - 8E2D2837174BEDA500B30576 /* HexColor Examples.app */, - ); - name = Products; - sourceTree = ""; - }; - 8E2D2839174BEDA500B30576 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 8E2D283A174BEDA500B30576 /* UIKit.framework */, - 8E2D283C174BEDA500B30576 /* Foundation.framework */, - 8E2D283E174BEDA500B30576 /* CoreGraphics.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 8E2D2840174BEDA500B30576 /* HexColor Examples */ = { - isa = PBXGroup; - children = ( - 8E2D2849174BEDA500B30576 /* AppDelegate.h */, - 8E2D284A174BEDA500B30576 /* AppDelegate.m */, - 8E2D2841174BEDA500B30576 /* Supporting Files */, - 8E2D285B174BEE1900B30576 /* HexColorExampleViewController.h */, - 8E2D285C174BEE1900B30576 /* HexColorExampleViewController.m */, - 8E2D285D174BEE1900B30576 /* HexColorExampleViewController.xib */, - 6DD2094217FEBB86000B398E /* Images.xcassets */, - ); - path = "HexColor Examples"; - sourceTree = ""; - }; - 8E2D2841174BEDA500B30576 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 8E2D2842174BEDA500B30576 /* HexColor Examples-Info.plist */, - 8E2D2843174BEDA500B30576 /* InfoPlist.strings */, - 8E2D2846174BEDA500B30576 /* main.m */, - 8E2D2848174BEDA500B30576 /* HexColor Examples-Prefix.pch */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8E2D2836174BEDA500B30576 /* HexColor Examples */ = { - isa = PBXNativeTarget; - buildConfigurationList = 8E2D2854174BEDA500B30576 /* Build configuration list for PBXNativeTarget "HexColor Examples" */; - buildPhases = ( - 8E2D2833174BEDA500B30576 /* Sources */, - 8E2D2834174BEDA500B30576 /* Frameworks */, - 8E2D2835174BEDA500B30576 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "HexColor Examples"; - productName = "HexColor Examples"; - productReference = 8E2D2837174BEDA500B30576 /* HexColor Examples.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 8E2D282F174BEDA500B30576 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0460; - ORGANIZATIONNAME = "Marius Landwehr"; - }; - buildConfigurationList = 8E2D2832174BEDA500B30576 /* Build configuration list for PBXProject "HexColor Examples" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 8E2D282E174BEDA500B30576; - productRefGroup = 8E2D2838174BEDA500B30576 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8E2D2836174BEDA500B30576 /* HexColor Examples */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8E2D2835174BEDA500B30576 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8E2D2845174BEDA500B30576 /* InfoPlist.strings in Resources */, - 6DD2094317FEBB86000B398E /* Images.xcassets in Resources */, - 8E2D285F174BEE1900B30576 /* HexColorExampleViewController.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8E2D2833174BEDA500B30576 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8E2D2847174BEDA500B30576 /* main.m in Sources */, - 2DACEC9E1A794CA900FEC3CE /* HexColors.m in Sources */, - 8E2D284B174BEDA500B30576 /* AppDelegate.m in Sources */, - 8E2D285E174BEE1900B30576 /* HexColorExampleViewController.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 8E2D2843174BEDA500B30576 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 8E2D2844174BEDA500B30576 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 8E2D2852174BEDA500B30576 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 8E2D2853174BEDA500B30576 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; - OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 8E2D2855174BEDA500B30576 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "HexColor Examples/HexColor Examples-Prefix.pch"; - INFOPLIST_FILE = "HexColor Examples/HexColor Examples-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - 8E2D2856174BEDA500B30576 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "HexColor Examples/HexColor Examples-Prefix.pch"; - INFOPLIST_FILE = "HexColor Examples/HexColor Examples-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 8E2D2832174BEDA500B30576 /* Build configuration list for PBXProject "HexColor Examples" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8E2D2852174BEDA500B30576 /* Debug */, - 8E2D2853174BEDA500B30576 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 8E2D2854174BEDA500B30576 /* Build configuration list for PBXNativeTarget "HexColor Examples" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8E2D2855174BEDA500B30576 /* Debug */, - 8E2D2856174BEDA500B30576 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 8E2D282F174BEDA500B30576 /* Project object */; -} diff --git a/Example/HexColor Examples.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/HexColor Examples.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 6ae2245..0000000 --- a/Example/HexColor Examples.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Example/HexColor Examples.xcodeproj/project.xcworkspace/xcshareddata/HexColor Examples.xccheckout b/Example/HexColor Examples.xcodeproj/project.xcworkspace/xcshareddata/HexColor Examples.xccheckout deleted file mode 100644 index 73ec75b..0000000 --- a/Example/HexColor Examples.xcodeproj/project.xcworkspace/xcshareddata/HexColor Examples.xccheckout +++ /dev/null @@ -1,41 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - 0F57C311-5867-47DE-A26F-FDF4124BEEE3 - IDESourceControlProjectName - HexColor Examples - IDESourceControlProjectOriginsDictionary - - A09197BDEFE5DB329169B5000201B999A865BEA1 - https://github.com/mRs-/HexColors - - IDESourceControlProjectPath - Example/HexColor Examples.xcodeproj - IDESourceControlProjectRelativeInstallPathDictionary - - A09197BDEFE5DB329169B5000201B999A865BEA1 - ../../.. - - IDESourceControlProjectURL - https://github.com/mRs-/HexColors - IDESourceControlProjectVersion - 111 - IDESourceControlProjectWCCIdentifier - A09197BDEFE5DB329169B5000201B999A865BEA1 - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - A09197BDEFE5DB329169B5000201B999A865BEA1 - IDESourceControlWCCName - HexColors - - - - diff --git a/Example/HexColor Examples/AppDelegate.h b/Example/HexColor Examples/AppDelegate.h deleted file mode 100644 index 41bf25b..0000000 --- a/Example/HexColor Examples/AppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// AppDelegate.h -// HexColor Examples -// -// Created by Marius Landwehr on 21.05.13. -// Copyright (c) 2013 Marius Landwehr. All rights reserved. -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/Example/HexColor Examples/AppDelegate.m b/Example/HexColor Examples/AppDelegate.m deleted file mode 100644 index 13d3a8f..0000000 --- a/Example/HexColor Examples/AppDelegate.m +++ /dev/null @@ -1,53 +0,0 @@ -// -// AppDelegate.m -// HexColor Examples -// -// Created by Marius Landwehr on 21.05.13. -// Copyright (c) 2013 Marius Landwehr. All rights reserved. -// - -#import "AppDelegate.h" -#import "HexColorExampleViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - - HexColorExampleViewController *exampleViewController = [[HexColorExampleViewController alloc] initWithNibName:nil bundle:nil]; - - self.window.rootViewController = exampleViewController; - - [self.window makeKeyAndVisible]; - return YES; -} - -- (void)applicationWillResignActive:(UIApplication *)application -{ - // 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. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. -} - -- (void)applicationDidEnterBackground:(UIApplication *)application -{ - // 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. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. -} - -- (void)applicationWillEnterForeground:(UIApplication *)application -{ - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. -} - -- (void)applicationDidBecomeActive:(UIApplication *)application -{ - // 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. -} - -- (void)applicationWillTerminate:(UIApplication *)application -{ - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. -} - -@end diff --git a/Example/HexColor Examples/HexColor Examples-Info.plist b/Example/HexColor Examples/HexColor Examples-Info.plist deleted file mode 100644 index 50bd11e..0000000 --- a/Example/HexColor Examples/HexColor Examples-Info.plist +++ /dev/null @@ -1,49 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - ${PRODUCT_NAME} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIcons - - CFBundleIcons~ipad - - CFBundleIdentifier - de.mariuslandwehr.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/Example/HexColor Examples/HexColor Examples-Prefix.pch b/Example/HexColor Examples/HexColor Examples-Prefix.pch deleted file mode 100644 index ea981d5..0000000 --- a/Example/HexColor Examples/HexColor Examples-Prefix.pch +++ /dev/null @@ -1,14 +0,0 @@ -// -// Prefix header for all source files of the 'HexColor Examples' target in the 'HexColor Examples' project -// - -#import - -#ifndef __IPHONE_3_0 -#warning "This project uses features only available in iOS SDK 3.0 and later." -#endif - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/Example/HexColor Examples/HexColorExampleViewController.h b/Example/HexColor Examples/HexColorExampleViewController.h deleted file mode 100644 index cb7284e..0000000 --- a/Example/HexColor Examples/HexColorExampleViewController.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// HexColorExampleViewController.h -// HexColor Examples -// -// Created by Marius Landwehr on 21.05.13. -// Copyright (c) 2013 Marius Landwehr. All rights reserved. -// - -#import - -@interface HexColorExampleViewController : UIViewController - -@property (strong, nonatomic) IBOutlet UIView *backgroundView; - -- (IBAction)colorOne:(id)sender; -- (IBAction)colorTwo:(id)sender; -- (IBAction)colorThree:(id)sender; -- (IBAction)color333:(id)sender; -- (IBAction)color656:(id)sender; -- (IBAction)color295:(id)sender; - -@end diff --git a/Example/HexColor Examples/HexColorExampleViewController.m b/Example/HexColor Examples/HexColorExampleViewController.m deleted file mode 100644 index 3b963e3..0000000 --- a/Example/HexColor Examples/HexColorExampleViewController.m +++ /dev/null @@ -1,74 +0,0 @@ -// -// HexColorExampleViewController.m -// HexColor Examples -// -// Created by Marius Landwehr on 21.05.13. -// Copyright (c) 2013 Marius Landwehr. All rights reserved. -// - -#import "HexColorExampleViewController.h" -#import "HexColors.h" - -@interface HexColorExampleViewController () - -@end - -@implementation HexColorExampleViewController - -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - // Custom initialization - } - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - // Do any additional setup after loading the view from its nib. -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -- (IBAction)colorOne:(id)sender { - [UIView animateWithDuration:0.3 animations:^{ - self.backgroundView.backgroundColor = [UIColor colorWithHexString:@"#999999"]; - }]; -} - -- (IBAction)colorTwo:(id)sender { - [UIView animateWithDuration:0.3 animations:^{ - self.backgroundView.backgroundColor = [UIColor colorWithHexString:@"#334455"]; - }]; -} - -- (IBAction)colorThree:(id)sender { - [UIView animateWithDuration:0.3 animations:^{ - self.backgroundView.backgroundColor = [UIColor colorWithHexString:@"#ff0099"]; - }]; -} - -- (IBAction)color333:(id)sender { - [UIView animateWithDuration:0.3 animations:^{ - self.backgroundView.backgroundColor = [UIColor colorWithHexString:@"333"]; - }]; -} - -- (IBAction)color656:(id)sender { - [UIView animateWithDuration:0.3 animations:^{ - self.backgroundView.backgroundColor = [UIColor colorWithHexString:@"656"]; - }]; -} - -- (IBAction)color295:(id)sender { - [UIView animateWithDuration:0.3 animations:^{ - self.backgroundView.backgroundColor = [UIColor colorWithHexString:@"295"]; - }]; -} -@end diff --git a/Example/HexColor Examples/HexColorExampleViewController.xib b/Example/HexColor Examples/HexColorExampleViewController.xib deleted file mode 100644 index 14aa815..0000000 --- a/Example/HexColor Examples/HexColorExampleViewController.xib +++ /dev/null @@ -1,738 +0,0 @@ - - - - 1552 - 12E55 - 3084 - 1187.39 - 626.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 2083 - - - IBNSLayoutConstraint - IBProxyObject - IBUIButton - IBUIView - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - - - 292 - {{20, 485}, {83, 44}} - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 1 - #999999 - - 3 - MQA - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - 3 - MC41AA - - - 2 - 15 - - - Helvetica-Bold - 15 - 16 - - - - - 292 - {{119, 485}, {83, 44}} - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 1 - #334455 - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - - - - 292 - {{224, 485}, {76, 44}} - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 1 - #ff0099 - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - - - - 292 - {{20, 434}, {83, 44}} - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 1 - #333 - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - - - - 292 - {{119, 434}, {83, 44}} - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 1 - #656 - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - - - - 292 - {{221, 434}, {83, 44}} - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 1 - #295 - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - - - {{0, 20}, {320, 548}} - - - - 3 - MQA - - 2 - - - - - IBUIScreenMetrics - - YES - - - - - - {320, 568} - {568, 320} - - - IBCocoaTouchFramework - Retina 4 Full Screen - 2 - - IBCocoaTouchFramework - - - - - - - view - - - - 3 - - - - backgroundView - - - - 24 - - - - colorOne: - - - 7 - - 21 - - - - colorTwo: - - - 7 - - 22 - - - - colorThree: - - - 7 - - 23 - - - - color333: - - - 7 - - 63 - - - - color656: - - - 7 - - 64 - - - - color295: - - - 7 - - 65 - - - - - - 0 - - - - - - 1 - - - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 4 - 0 - - 4 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 4 - 0 - - 4 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 11 - 0 - - 11 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 3 - 0 - - 4 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - - - - 4 - 0 - - 4 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 11 - 0 - - 11 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 5 - 22 - 2 - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 4 - - - - - 5 - - - - - 7 - - - - - 8 - - - - - 12 - - - - - 14 - - - - - 18 - - - - - 20 - - - - - 25 - - - - - - 27 - - - - - 31 - - - - - 26 - - - - - 34 - - - - - 35 - - - - - 37 - - - - - 39 - - - - - 40 - - - - - 7 - 0 - - 0 - 1 - - 83 - - 1000 - - 3 - 9 - 1 - - - - - - 42 - - - - - 43 - - - - - 44 - - - - - 36 - - - - - - - HexColorExampleViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - - - - - - - - - - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - - 65 - - - 0 - IBCocoaTouchFramework - YES - 3 - YES - 2083 - - diff --git a/Example/HexColor Examples/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/HexColor Examples/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index da837d9..0000000 --- a/Example/HexColor Examples/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "scale" : "1x", - "size" : "57x57" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "57x57" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "60x60" - }, - { - "idiom" : "ipad", - "scale" : "1x", - "size" : "72x72" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "72x72" - }, - { - "idiom" : "ipad", - "scale" : "1x", - "size" : "76x76" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "76x76" - }, - { - "idiom" : "iphone", - "scale" : "1x", - "size" : "29x29" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "29x29" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "40x40" - }, - { - "idiom" : "ipad", - "scale" : "1x", - "size" : "50x50" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "50x50" - }, - { - "idiom" : "ipad", - "scale" : "1x", - "size" : "40x40" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "40x40" - }, - { - "idiom" : "ipad", - "scale" : "1x", - "size" : "29x29" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "29x29" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/HexColor Examples/Images.xcassets/LaunchImage.launchimage/Contents.json b/Example/HexColor Examples/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index a2a7d96..0000000 --- a/Example/HexColor Examples/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default.png", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default@2x.png", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default-568h@2x.png", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default@2x.png", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default-568h@2x.png", - "minimum-system-version" : "7.0", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "minimum-system-version" : "7.0", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "minimum-system-version" : "7.0", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "minimum-system-version" : "7.0", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "minimum-system-version" : "7.0", - "extent" : "full-screen", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/HexColor Examples/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/Example/HexColor Examples/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png deleted file mode 100644 index 0891b7a..0000000 Binary files a/Example/HexColor Examples/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png and /dev/null differ diff --git a/Example/HexColor Examples/Images.xcassets/LaunchImage.launchimage/Default.png b/Example/HexColor Examples/Images.xcassets/LaunchImage.launchimage/Default.png deleted file mode 100644 index 4c8ca6f..0000000 Binary files a/Example/HexColor Examples/Images.xcassets/LaunchImage.launchimage/Default.png and /dev/null differ diff --git a/Example/HexColor Examples/Images.xcassets/LaunchImage.launchimage/Default@2x.png b/Example/HexColor Examples/Images.xcassets/LaunchImage.launchimage/Default@2x.png deleted file mode 100644 index 35b84cf..0000000 Binary files a/Example/HexColor Examples/Images.xcassets/LaunchImage.launchimage/Default@2x.png and /dev/null differ diff --git a/Example/HexColor Examples/en.lproj/InfoPlist.strings b/Example/HexColor Examples/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28f..0000000 --- a/Example/HexColor Examples/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/Example/HexColor Examples/main.m b/Example/HexColor Examples/main.m deleted file mode 100644 index 2fa1a81..0000000 --- a/Example/HexColor Examples/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// HexColor Examples -// -// Created by Marius Landwehr on 21.05.13. -// Copyright (c) 2013 Marius Landwehr. All rights reserved. -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char *argv[]) -{ - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/HexColors-iOS/HexColors-iOS.h b/HexColors-iOS/HexColors-iOS.h new file mode 100644 index 0000000..c29f71a --- /dev/null +++ b/HexColors-iOS/HexColors-iOS.h @@ -0,0 +1,19 @@ +// +// HexColors-iOS.h +// HexColors-iOS +// +// Created by Marius Landwehr on 26.12.16. +// Copyright © 2016 Marius Landwehr. All rights reserved. +// + +#import + +//! Project version number for HexColors-iOS. +FOUNDATION_EXPORT double HexColors_iOSVersionNumber; + +//! Project version string for HexColors-iOS. +FOUNDATION_EXPORT const unsigned char HexColors_iOSVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/HexColors/Info.plist b/HexColors-iOS/Info.plist similarity index 81% rename from HexColors/Info.plist rename to HexColors-iOS/Info.plist index 32aaadf..935a9e9 100644 --- a/HexColors/Info.plist +++ b/HexColors-iOS/Info.plist @@ -7,17 +7,15 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - reversebox.org.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName - $(PRODUCT_NAME) + HexColors CFBundlePackageType FMWK CFBundleShortVersionString 1.0 - CFBundleSignature - ???? CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/HexColors-iOSTests/HexColors_iOSTests.swift b/HexColors-iOSTests/HexColors_iOSTests.swift new file mode 100644 index 0000000..baf8d98 --- /dev/null +++ b/HexColors-iOSTests/HexColors_iOSTests.swift @@ -0,0 +1,143 @@ +// +// HexColors_iOSTests.swift +// HexColors-iOSTests +// +// Created by Marius Landwehr on 26.12.16. +// Copyright © 2016 Marius Landwehr. All rights reserved. +// + +import XCTest +@testable import HexColors + +class HexColors_iOSTests: XCTestCase { + + func testCantCreateColorFromEmptyString() { + + XCTAssertNil(UIColor("")) + } + + func testCantCreateColorFromEmptyStringWithAlpha() { + + XCTAssertNil(UIColor("", alpha: 0.2)) + } + + func testCantCreateColorFromStringThatsNotHexConform() { + + XCTAssertNil(UIColor("Wow what a nice view!")) + } + + func testCantCreateColorFromStringThatsNotHexConformWithAlpha() { + + XCTAssertNil(UIColor("Wow what a nice view!", alpha: 0.2)) + } + + func testCantCreateColorFromStringWith3CharactersThatAreNotInHexRange() { + XCTAssertNil(UIColor("ZXY")) + } + + func testCantCreateColorFromStringWith3CharactersThatAreNotInHexRangeWithAlpha() { + XCTAssertNil(UIColor("ZXY", alpha: 0.2)) + } + + func testCantCreateColorFromStringWith4CharactersThatAreNotInHexRange() { + XCTAssertNil(UIColor("ZXYL")) + } + + func testCantCreateColorFromStringWith4CharactersThatAreNotInHexRangeWithAlpha() { + XCTAssertNil(UIColor("ZXYL", alpha: 0.2)) + } + + func testCantCreateColorFromStringWith6CharactersThatAreNotInHexRange() { + XCTAssertNil(UIColor("ZXYLPK")) + } + + func testCantCreateColorFromStringWith6CharactersThatAreNotInHexRangeWithAlpha() { + XCTAssertNil(UIColor("ZXYLPK", alpha: 0.2)) + } + + func testCantCreateColorFromStringWith8CharactersThatAreNotInHexRange() { + XCTAssertNil(UIColor("ZXYLPKXX")) + } + + func testCantCreateColorFromStringWith8CharactersThatAreNotInHexRangeWithAlpha() { + XCTAssertNil(UIColor("ZXYLPKXX", alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith3Characters() { + XCTAssertEqual(UIColor("FFF"), UIColor(red: 1, green: 1, blue: 1, alpha: 1)) + } + + func testCanCreateColorFromValidHexStringWith3CharactersAndHashPrefix() { + XCTAssertEqual(UIColor("#FFF"), UIColor(red: 1, green: 1, blue: 1, alpha: 1)) + } + + func testCanCreateColorFromValidHexStringWith3CharactersAndAlpha() { + XCTAssertEqual(UIColor("FFF", alpha: 0.2), UIColor(red: 1, green: 1, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith3CharactersAndAlphaAndHashPrefix() { + XCTAssertEqual(UIColor("#FFF", alpha: 0.2), UIColor(red: 1, green: 1, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith4Characters() { + XCTAssertEqual(UIColor("FFF0"), UIColor(red: 1, green: 1, blue: 1, alpha: 0)) + } + + func testCanCreateColorFromValidHexStringWith4CharactersAndHashPrefix() { + XCTAssertEqual(UIColor("#FFF0"), UIColor(red: 1, green: 1, blue: 1, alpha: 0)) + } + + func testCanCreateColorFromValidHexStringWith4CharactersAndAlpha() { + XCTAssertEqual(UIColor("FFFF", alpha: 0.2), UIColor(red: 1, green: 1, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith4CharactersAndAlphaAndHashPrefix() { + XCTAssertEqual(UIColor("#FFFF", alpha: 0.2), UIColor(red: 1, green: 1, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith6Characters() { + XCTAssertEqual(UIColor("FF00FF"), UIColor(red: 1, green: 0, blue: 1, alpha: 1)) + } + + func testCanCreateColorFromValidHexStringWith6CharactersAndHashPrefix() { + XCTAssertEqual(UIColor("#FF00FF"), UIColor(red: 1, green: 0, blue: 1, alpha: 1)) + } + + func testCanCreateColorFromValidHexStringWith6CharactersAndAlpha() { + XCTAssertEqual(UIColor("FF00FF", alpha: 0.2), UIColor(red: 1, green: 0, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith6CharactersAndAlphaAndHashPrefix() { + XCTAssertEqual(UIColor("#FF00FF", alpha: 0.2), UIColor(red: 1, green: 0, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith8Characters() { + XCTAssertEqual(UIColor("FF00FF00"), UIColor(red: 1, green: 0, blue: 1, alpha: 0)) + } + + func testCanCreateColorFromValidHexStringWith8CharactersAndHashPrefix() { + XCTAssertEqual(UIColor("#FF00FF00"), UIColor(red: 1, green: 0, blue: 1, alpha: 0)) + } + + func testCanCreateColorFromValidHexStringWith8CharactersAndAlpha() { + XCTAssertEqual(UIColor("FF00FFFF", alpha: 0.2), UIColor(red: 1, green: 0, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith8CharactersAndAlphaAndHashPrefix() { + XCTAssertEqual(UIColor("#FF00FFFF", alpha: 0.2), UIColor(red: 1, green: 0, blue: 1, alpha: 0.2)) + } + + func testCanTransformToColorAndBackToHexString() { + let hexString = "#ff00ff" + let color = UIColor(hexString) + + XCTAssertEqual(hexString, color?.hex) + } + + func testCanTransformToColorWithAlphaAndBackToHexString() { + let hexString = "#ff00ff00" + let color = UIColor(hexString) + + XCTAssertEqual(hexString, color?.hex) + } +} diff --git a/HexColorsTests/Info.plist b/HexColors-iOSTests/Info.plist similarity index 92% rename from HexColorsTests/Info.plist rename to HexColors-iOSTests/Info.plist index ba72822..6c6c23c 100644 --- a/HexColorsTests/Info.plist +++ b/HexColors-iOSTests/Info.plist @@ -16,8 +16,6 @@ BNDL CFBundleShortVersionString 1.0 - CFBundleSignature - ???? CFBundleVersion 1 diff --git a/HexColors-macOS/HexColors-macOS.h b/HexColors-macOS/HexColors-macOS.h new file mode 100644 index 0000000..439c048 --- /dev/null +++ b/HexColors-macOS/HexColors-macOS.h @@ -0,0 +1,19 @@ +// +// HexColors-macOS.h +// HexColors-macOS +// +// Created by Marius Landwehr on 26.12.16. +// Copyright © 2016 Marius Landwehr. All rights reserved. +// + +#import + +//! Project version number for HexColors-macOS. +FOUNDATION_EXPORT double HexColors_macOSVersionNumber; + +//! Project version string for HexColors-macOS. +FOUNDATION_EXPORT const unsigned char HexColors_macOSVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/HexColorsOSX/Info.plist b/HexColors-macOS/Info.plist similarity index 76% rename from HexColorsOSX/Info.plist rename to HexColors-macOS/Info.plist index a0c5627..3407e82 100644 --- a/HexColorsOSX/Info.plist +++ b/HexColors-macOS/Info.plist @@ -7,21 +7,19 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - reversebox.org.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName - $(PRODUCT_NAME) + HexColors CFBundlePackageType FMWK CFBundleShortVersionString 1.0 - CFBundleSignature - ???? CFBundleVersion $(CURRENT_PROJECT_VERSION) NSHumanReadableCopyright - Copyright © 2015 Reversebox. All rights reserved. + Copyright © 2016 Marius Landwehr. All rights reserved. NSPrincipalClass diff --git a/HexColors-macOSTests/HexColors_macOSTests.swift b/HexColors-macOSTests/HexColors_macOSTests.swift new file mode 100644 index 0000000..0e22f67 --- /dev/null +++ b/HexColors-macOSTests/HexColors_macOSTests.swift @@ -0,0 +1,142 @@ +// +// HexColors_macOSTests.swift +// HexColors-macOSTests +// +// Created by Marius Landwehr on 26.12.16. +// Copyright © 2016 Marius Landwehr. All rights reserved. +// + +import XCTest +@testable import HexColors + +class HexColors_macOSTests: XCTestCase { + + func testCantCreateColorFromEmptyString() { + XCTAssertNil(NSColor("")) + } + + func testCantCreateColorFromEmptyStringWithAlpha() { + XCTAssertNil(NSColor("", alpha: 0.2)) + } + + func testCantCreateColorFromStringThatsNotHexConform() { + + XCTAssertNil(NSColor("Wow what a nice view!")) + } + + func testCantCreateColorFromStringThatsNotHexConformWithAlpha() { + + XCTAssertNil(NSColor("Wow what a nice view!", alpha: 0.2)) + } + + func testCantCreateColorFromStringWith3CharactersThatAreNotInHexRange() { + XCTAssertNil(NSColor("ZXY")) + } + + func testCantCreateColorFromStringWith3CharactersThatAreNotInHexRangeWithAlpha() { + XCTAssertNil(NSColor("ZXY", alpha: 0.2)) + } + + func testCantCreateColorFromStringWith4CharactersThatAreNotInHexRange() { + XCTAssertNil(NSColor("ZXYL")) + } + + func testCantCreateColorFromStringWith4CharactersThatAreNotInHexRangeWithAlpha() { + XCTAssertNil(NSColor("ZXYL", alpha: 0.2)) + } + + func testCantCreateColorFromStringWith6CharactersThatAreNotInHexRange() { + XCTAssertNil(NSColor("ZXYLPK")) + } + + func testCantCreateColorFromStringWith6CharactersThatAreNotInHexRangeWithAlpha() { + XCTAssertNil(NSColor("ZXYLPK", alpha: 0.2)) + } + + func testCantCreateColorFromStringWith8CharactersThatAreNotInHexRange() { + XCTAssertNil(NSColor("ZXYLPKXX")) + } + + func testCantCreateColorFromStringWith8CharactersThatAreNotInHexRangeWithAlpha() { + XCTAssertNil(NSColor("ZXYLPKXX", alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith3Characters() { + XCTAssertEqual(NSColor("FFF"), NSColor(calibratedRed: 1, green: 1, blue: 1, alpha: 1)) + } + + func testCanCreateColorFromValidHexStringWith3CharactersAndHashPrefix() { + XCTAssertEqual(NSColor("#FFF"), NSColor(calibratedRed: 1, green: 1, blue: 1, alpha: 1)) + } + + func testCanCreateColorFromValidHexStringWith3CharactersAndAlpha() { + XCTAssertEqual(NSColor("FFF", alpha: 0.2), NSColor(calibratedRed: 1, green: 1, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith3CharactersAndAlphaAndHashPrefix() { + XCTAssertEqual(NSColor("#FFF", alpha: 0.2), NSColor(calibratedRed: 1, green: 1, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith4Characters() { + XCTAssertEqual(NSColor("FFF0"), NSColor(calibratedRed: 1, green: 1, blue: 1, alpha: 0)) + } + + func testCanCreateColorFromValidHexStringWith4CharactersAndHashPrefix() { + XCTAssertEqual(NSColor("#FFF0"), NSColor(calibratedRed: 1, green: 1, blue: 1, alpha: 0)) + } + + func testCanCreateColorFromValidHexStringWith4CharactersAndAlpha() { + XCTAssertEqual(NSColor("FFFF", alpha: 0.2), NSColor(calibratedRed: 1, green: 1, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith4CharactersAndAlphaAndHashPrefix() { + XCTAssertEqual(NSColor("#FFFF", alpha: 0.2), NSColor(calibratedRed: 1, green: 1, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith6Characters() { + XCTAssertEqual(NSColor("FF00FF"), NSColor(calibratedRed: 1, green: 0, blue: 1, alpha: 1)) + } + + func testCanCreateColorFromValidHexStringWith6CharactersAndHashPrefix() { + XCTAssertEqual(NSColor("#FF00FF"), NSColor(calibratedRed: 1, green: 0, blue: 1, alpha: 1)) + } + + func testCanCreateColorFromValidHexStringWith6CharactersAndAlpha() { + XCTAssertEqual(NSColor("FF00FF", alpha: 0.2), NSColor(calibratedRed: 1, green: 0, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith6CharactersAndAlphaAndHashPrefix() { + XCTAssertEqual(NSColor("#FF00FF", alpha: 0.2), NSColor(calibratedRed: 1, green: 0, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith8Characters() { + XCTAssertEqual(NSColor("FF00FF00"), NSColor(calibratedRed: 1, green: 0, blue: 1, alpha: 0)) + } + + func testCanCreateColorFromValidHexStringWith8CharactersAndHashPrefix() { + XCTAssertEqual(NSColor("#FF00FF00"), NSColor(calibratedRed: 1, green: 0, blue: 1, alpha: 0)) + } + + func testCanCreateColorFromValidHexStringWith8CharactersAndAlpha() { + XCTAssertEqual(NSColor("FF00FFFF", alpha: 0.2), NSColor(calibratedRed: 1, green: 0, blue: 1, alpha: 0.2)) + } + + func testCanCreateColorFromValidHexStringWith8CharactersAndAlphaAndHashPrefix() { + XCTAssertEqual(NSColor("#FF00FFFF", alpha: 0.2), NSColor(calibratedRed: 1, green: 0, blue: 1, alpha: 0.2)) + } + + func testCanTransformToColorAndBackToHexString() { + let hexString = "#ff00ff" + let color = NSColor(hexString) + + XCTAssertEqual(hexString, color?.hex) + } + + func testCanTransformToColorWithAlphaAndBackToHexString() { + let hexString = "#ff00ff00" + let color = NSColor(hexString) + + XCTAssertEqual(hexString, color?.hex) + } + +} diff --git a/HexColors-macOSTests/Info.plist b/HexColors-macOSTests/Info.plist new file mode 100644 index 0000000..6c6c23c --- /dev/null +++ b/HexColors-macOSTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/HexColors.png b/HexColors.png new file mode 100644 index 0000000..1d375a6 Binary files /dev/null and b/HexColors.png differ diff --git a/HexColors.podspec b/HexColors.podspec index 81c3519..fdfde33 100644 --- a/HexColors.podspec +++ b/HexColors.podspec @@ -1,17 +1,19 @@ Pod::Spec.new do |s| - s.name = 'HexColors' - s.version = '4.0.0' - s.license = 'MIT' - s.summary = 'Easy HEX- and RGB-Color Handling for UIColor and NSColor as a drop in category. Former MLUIColorAdditions.' + s.name = 'HexColors' + s.version = '5.0.0' + s.license = 'MIT' + s.summary = 'HexColors is an extension for UIColor and NSColor to support for creating colors from a hex strings.' s.homepage = 'https://github.com/mRs-/HexColors' s.description = %{ - HexColors is easy drop in category for HexColor integration in iOS and Mac OS X. Its build as a category for easy to use and can be used for UIColor and NSColor class. + HexColors is an extension for UIColor and NSColor to support for creating colors from a hex string like #FF0088 or 8844FF and back to a String. Completely rewritten in Swift 3! + + If you want to use this in Objective-C jump to the 4.X version Tag. } - s.author = { "Marius Landwehr" => "marius.landwehr@gmail.com", "holgersindbaek" => "holgersindbaek@gmail.com" } - s.source = { :git => 'https://github.com/mRs-/HexColors.git', :tag => s.version.to_s} - s.ios.deployment_target = '5.0' - s.osx.deployment_target = '10.6' + s.author = { "Marius Landwehr" => "marius.landwehr@gmail.com" } + s.source = { :git => 'https://github.com/mRs-/HexColors.git', :tag => s.version.to_s} + s.ios.deployment_target = '8.0' + s.osx.deployment_target = '10.9' s.watchos.deployment_target = '2.0' s.tvos.deployment_target = '9.0' - s.source_files = 'Classes/HexColors.{h,m}' + s.source_files = 'Sources/*.swift' end diff --git a/HexColors.xcodeproj/project.pbxproj b/HexColors.xcodeproj/project.pbxproj index e4703fe..3b1880f 100644 --- a/HexColors.xcodeproj/project.pbxproj +++ b/HexColors.xcodeproj/project.pbxproj @@ -7,265 +7,318 @@ objects = { /* Begin PBXBuildFile section */ - 2DACED241A794E1B00FEC3CE /* HexColors.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DACED221A794E1B00FEC3CE /* HexColors.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2DACED251A794E1B00FEC3CE /* HexColors.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DACED221A794E1B00FEC3CE /* HexColors.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2DACED261A794E1B00FEC3CE /* HexColors.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DACED231A794E1B00FEC3CE /* HexColors.m */; }; - 2DACED271A794E1B00FEC3CE /* HexColors.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DACED231A794E1B00FEC3CE /* HexColors.m */; }; - 8EB8367F1C46E8A80008E218 /* HexColorsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EB8367E1C46E8A80008E218 /* HexColorsTests.m */; }; - 8EB836811C46E8A80008E218 /* HexColors.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DACECA91A794CD800FEC3CE /* HexColors.framework */; }; - 8EB836871C46E9830008E218 /* HexColors.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DACED231A794E1B00FEC3CE /* HexColors.m */; }; + 293AB3451E111F0B004A4946 /* HexColors.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 293AB33C1E111F0B004A4946 /* HexColors.framework */; }; + 293AB34A1E111F0B004A4946 /* HexColors_iOSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 293AB3491E111F0B004A4946 /* HexColors_iOSTests.swift */; }; + 293AB34C1E111F0B004A4946 /* HexColors-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 293AB33E1E111F0B004A4946 /* HexColors-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 293AB3531E111F20004A4946 /* HexColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 293AB3341E111E88004A4946 /* HexColors.swift */; }; + 293AB3621E111F53004A4946 /* HexColors.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 293AB3591E111F53004A4946 /* HexColors.framework */; }; + 293AB3671E111F53004A4946 /* HexColors_macOSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 293AB3661E111F53004A4946 /* HexColors_macOSTests.swift */; }; + 293AB3691E111F53004A4946 /* HexColors-macOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 293AB35B1E111F53004A4946 /* HexColors-macOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 293AB3701E111F5A004A4946 /* HexColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 293AB3341E111E88004A4946 /* HexColors.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 8EB836821C46E8A80008E218 /* PBXContainerItemProxy */ = { + 293AB3461E111F0B004A4946 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 2DACECA01A794CD800FEC3CE /* Project object */; + containerPortal = 293AB3171E111E68004A4946 /* Project object */; proxyType = 1; - remoteGlobalIDString = 2DACECA81A794CD800FEC3CE; - remoteInfo = HexColors; + remoteGlobalIDString = 293AB33B1E111F0B004A4946; + remoteInfo = "HexColors-iOS"; + }; + 293AB3631E111F53004A4946 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 293AB3171E111E68004A4946 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 293AB3581E111F53004A4946; + remoteInfo = "HexColors-macOS"; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 2DACECA91A794CD800FEC3CE /* HexColors.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = HexColors.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 2DACECAD1A794CD800FEC3CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 2DACED081A794E0500FEC3CE /* HexColorsOSX.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = HexColorsOSX.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 2DACED0B1A794E0500FEC3CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 2DACED221A794E1B00FEC3CE /* HexColors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HexColors.h; sourceTree = ""; }; - 2DACED231A794E1B00FEC3CE /* HexColors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HexColors.m; sourceTree = ""; }; - 8EB8367C1C46E8A80008E218 /* HexColorsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HexColorsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 8EB8367E1C46E8A80008E218 /* HexColorsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HexColorsTests.m; sourceTree = ""; }; - 8EB836801C46E8A80008E218 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 293AB3341E111E88004A4946 /* HexColors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = HexColors.swift; path = Sources/HexColors.swift; sourceTree = ""; }; + 293AB33C1E111F0B004A4946 /* HexColors.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = HexColors.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 293AB33E1E111F0B004A4946 /* HexColors-iOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "HexColors-iOS.h"; sourceTree = ""; }; + 293AB33F1E111F0B004A4946 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 293AB3441E111F0B004A4946 /* HexColors-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "HexColors-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 293AB3491E111F0B004A4946 /* HexColors_iOSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HexColors_iOSTests.swift; sourceTree = ""; }; + 293AB34B1E111F0B004A4946 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 293AB3591E111F53004A4946 /* HexColors.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = HexColors.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 293AB35B1E111F53004A4946 /* HexColors-macOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "HexColors-macOS.h"; sourceTree = ""; }; + 293AB35C1E111F53004A4946 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 293AB3611E111F53004A4946 /* HexColors-macOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "HexColors-macOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 293AB3661E111F53004A4946 /* HexColors_macOSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HexColors_macOSTests.swift; sourceTree = ""; }; + 293AB3681E111F53004A4946 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 29E034CD1E1477EF00BC16BC /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 2DACECA51A794CD800FEC3CE /* Frameworks */ = { + 293AB3381E111F0B004A4946 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 2DACED041A794E0500FEC3CE /* Frameworks */ = { + 293AB3411E111F0B004A4946 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 293AB3451E111F0B004A4946 /* HexColors.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 8EB836791C46E8A80008E218 /* Frameworks */ = { + 293AB3551E111F53004A4946 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8EB836811C46E8A80008E218 /* HexColors.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 293AB35E1E111F53004A4946 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 293AB3621E111F53004A4946 /* HexColors.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 2DACEC9F1A794CD800FEC3CE = { + 293AB3161E111E68004A4946 = { isa = PBXGroup; children = ( - 2DACED211A794E1B00FEC3CE /* Classes */, - 2DACECAB1A794CD800FEC3CE /* HexColors */, - 2DACED091A794E0500FEC3CE /* HexColorsOSX */, - 8EB8367D1C46E8A80008E218 /* HexColorsTests */, - 2DACECAA1A794CD800FEC3CE /* Products */, + 29E034CD1E1477EF00BC16BC /* Package.swift */, + 293AB3361E111E96004A4946 /* Classes */, + 293AB33D1E111F0B004A4946 /* HexColors-iOS */, + 293AB3481E111F0B004A4946 /* HexColors-iOSTests */, + 293AB35A1E111F53004A4946 /* HexColors-macOS */, + 293AB3651E111F53004A4946 /* HexColors-macOSTests */, + 293AB3201E111E68004A4946 /* Products */, ); sourceTree = ""; }; - 2DACECAA1A794CD800FEC3CE /* Products */ = { + 293AB3201E111E68004A4946 /* Products */ = { isa = PBXGroup; children = ( - 2DACECA91A794CD800FEC3CE /* HexColors.framework */, - 2DACED081A794E0500FEC3CE /* HexColorsOSX.framework */, - 8EB8367C1C46E8A80008E218 /* HexColorsTests.xctest */, + 293AB33C1E111F0B004A4946 /* HexColors.framework */, + 293AB3441E111F0B004A4946 /* HexColors-iOSTests.xctest */, + 293AB3591E111F53004A4946 /* HexColors.framework */, + 293AB3611E111F53004A4946 /* HexColors-macOSTests.xctest */, ); name = Products; sourceTree = ""; }; - 2DACECAB1A794CD800FEC3CE /* HexColors */ = { - isa = PBXGroup; - children = ( - 2DACECAC1A794CD800FEC3CE /* Supporting Files */, - ); - path = HexColors; - sourceTree = ""; - }; - 2DACECAC1A794CD800FEC3CE /* Supporting Files */ = { + 293AB3361E111E96004A4946 /* Classes */ = { isa = PBXGroup; children = ( - 2DACECAD1A794CD800FEC3CE /* Info.plist */, + 293AB3341E111E88004A4946 /* HexColors.swift */, ); - name = "Supporting Files"; + name = Classes; sourceTree = ""; }; - 2DACED091A794E0500FEC3CE /* HexColorsOSX */ = { + 293AB33D1E111F0B004A4946 /* HexColors-iOS */ = { isa = PBXGroup; children = ( - 2DACED0A1A794E0500FEC3CE /* Supporting Files */, + 293AB33E1E111F0B004A4946 /* HexColors-iOS.h */, + 293AB33F1E111F0B004A4946 /* Info.plist */, ); - path = HexColorsOSX; + path = "HexColors-iOS"; sourceTree = ""; }; - 2DACED0A1A794E0500FEC3CE /* Supporting Files */ = { + 293AB3481E111F0B004A4946 /* HexColors-iOSTests */ = { isa = PBXGroup; children = ( - 2DACED0B1A794E0500FEC3CE /* Info.plist */, + 293AB3491E111F0B004A4946 /* HexColors_iOSTests.swift */, + 293AB34B1E111F0B004A4946 /* Info.plist */, ); - name = "Supporting Files"; + path = "HexColors-iOSTests"; sourceTree = ""; }; - 2DACED211A794E1B00FEC3CE /* Classes */ = { + 293AB35A1E111F53004A4946 /* HexColors-macOS */ = { isa = PBXGroup; children = ( - 2DACED221A794E1B00FEC3CE /* HexColors.h */, - 2DACED231A794E1B00FEC3CE /* HexColors.m */, + 293AB35B1E111F53004A4946 /* HexColors-macOS.h */, + 293AB35C1E111F53004A4946 /* Info.plist */, ); - path = Classes; + path = "HexColors-macOS"; sourceTree = ""; }; - 8EB8367D1C46E8A80008E218 /* HexColorsTests */ = { + 293AB3651E111F53004A4946 /* HexColors-macOSTests */ = { isa = PBXGroup; children = ( - 8EB8367E1C46E8A80008E218 /* HexColorsTests.m */, - 8EB836801C46E8A80008E218 /* Info.plist */, + 293AB3661E111F53004A4946 /* HexColors_macOSTests.swift */, + 293AB3681E111F53004A4946 /* Info.plist */, ); - path = HexColorsTests; + path = "HexColors-macOSTests"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 2DACECA61A794CD800FEC3CE /* Headers */ = { + 293AB3391E111F0B004A4946 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 2DACED241A794E1B00FEC3CE /* HexColors.h in Headers */, + 293AB34C1E111F0B004A4946 /* HexColors-iOS.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 2DACED051A794E0500FEC3CE /* Headers */ = { + 293AB3561E111F53004A4946 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 2DACED251A794E1B00FEC3CE /* HexColors.h in Headers */, + 293AB3691E111F53004A4946 /* HexColors-macOS.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 2DACECA81A794CD800FEC3CE /* HexColors */ = { + 293AB33B1E111F0B004A4946 /* HexColors-iOS */ = { isa = PBXNativeTarget; - buildConfigurationList = 2DACECBF1A794CD800FEC3CE /* Build configuration list for PBXNativeTarget "HexColors" */; + buildConfigurationList = 293AB34D1E111F0B004A4946 /* Build configuration list for PBXNativeTarget "HexColors-iOS" */; buildPhases = ( - 2DACECA41A794CD800FEC3CE /* Sources */, - 2DACECA51A794CD800FEC3CE /* Frameworks */, - 2DACECA61A794CD800FEC3CE /* Headers */, - 2DACECA71A794CD800FEC3CE /* Resources */, + 293AB3371E111F0B004A4946 /* Sources */, + 293AB3381E111F0B004A4946 /* Frameworks */, + 293AB3391E111F0B004A4946 /* Headers */, + 293AB33A1E111F0B004A4946 /* Resources */, ); buildRules = ( ); dependencies = ( ); - name = HexColors; - productName = HexColors; - productReference = 2DACECA91A794CD800FEC3CE /* HexColors.framework */; + name = "HexColors-iOS"; + productName = "HexColors-iOS"; + productReference = 293AB33C1E111F0B004A4946 /* HexColors.framework */; productType = "com.apple.product-type.framework"; }; - 2DACED071A794E0500FEC3CE /* HexColorsOSX */ = { + 293AB3431E111F0B004A4946 /* HexColors-iOSTests */ = { isa = PBXNativeTarget; - buildConfigurationList = 2DACED1B1A794E0500FEC3CE /* Build configuration list for PBXNativeTarget "HexColorsOSX" */; + buildConfigurationList = 293AB3501E111F0B004A4946 /* Build configuration list for PBXNativeTarget "HexColors-iOSTests" */; buildPhases = ( - 2DACED031A794E0500FEC3CE /* Sources */, - 2DACED041A794E0500FEC3CE /* Frameworks */, - 2DACED051A794E0500FEC3CE /* Headers */, - 2DACED061A794E0500FEC3CE /* Resources */, + 293AB3401E111F0B004A4946 /* Sources */, + 293AB3411E111F0B004A4946 /* Frameworks */, + 293AB3421E111F0B004A4946 /* Resources */, ); buildRules = ( ); dependencies = ( + 293AB3471E111F0B004A4946 /* PBXTargetDependency */, ); - name = HexColorsOSX; - productName = HexColorsOSX; - productReference = 2DACED081A794E0500FEC3CE /* HexColorsOSX.framework */; + name = "HexColors-iOSTests"; + productName = "HexColors-iOSTests"; + productReference = 293AB3441E111F0B004A4946 /* HexColors-iOSTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 293AB3581E111F53004A4946 /* HexColors-macOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 293AB36A1E111F53004A4946 /* Build configuration list for PBXNativeTarget "HexColors-macOS" */; + buildPhases = ( + 293AB3541E111F53004A4946 /* Sources */, + 293AB3551E111F53004A4946 /* Frameworks */, + 293AB3561E111F53004A4946 /* Headers */, + 293AB3571E111F53004A4946 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "HexColors-macOS"; + productName = "HexColors-macOS"; + productReference = 293AB3591E111F53004A4946 /* HexColors.framework */; productType = "com.apple.product-type.framework"; }; - 8EB8367B1C46E8A80008E218 /* HexColorsTests */ = { + 293AB3601E111F53004A4946 /* HexColors-macOSTests */ = { isa = PBXNativeTarget; - buildConfigurationList = 8EB836861C46E8A80008E218 /* Build configuration list for PBXNativeTarget "HexColorsTests" */; + buildConfigurationList = 293AB36D1E111F53004A4946 /* Build configuration list for PBXNativeTarget "HexColors-macOSTests" */; buildPhases = ( - 8EB836781C46E8A80008E218 /* Sources */, - 8EB836791C46E8A80008E218 /* Frameworks */, - 8EB8367A1C46E8A80008E218 /* Resources */, + 293AB35D1E111F53004A4946 /* Sources */, + 293AB35E1E111F53004A4946 /* Frameworks */, + 293AB35F1E111F53004A4946 /* Resources */, ); buildRules = ( ); dependencies = ( - 8EB836831C46E8A80008E218 /* PBXTargetDependency */, + 293AB3641E111F53004A4946 /* PBXTargetDependency */, ); - name = HexColorsTests; - productName = HexColorsTests; - productReference = 8EB8367C1C46E8A80008E218 /* HexColorsTests.xctest */; + name = "HexColors-macOSTests"; + productName = "HexColors-macOSTests"; + productReference = 293AB3611E111F53004A4946 /* HexColors-macOSTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - 2DACECA01A794CD800FEC3CE /* Project object */ = { + 293AB3171E111E68004A4946 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0610; - ORGANIZATIONNAME = Reversebox; + LastSwiftUpdateCheck = 0820; + LastUpgradeCheck = 0820; + ORGANIZATIONNAME = "Marius Landwehr"; TargetAttributes = { - 2DACECA81A794CD800FEC3CE = { - CreatedOnToolsVersion = 6.1.1; + 293AB33B1E111F0B004A4946 = { + CreatedOnToolsVersion = 8.2; + ProvisioningStyle = Automatic; }; - 2DACED071A794E0500FEC3CE = { - CreatedOnToolsVersion = 6.1.1; + 293AB3431E111F0B004A4946 = { + CreatedOnToolsVersion = 8.2; + ProvisioningStyle = Automatic; }; - 8EB8367B1C46E8A80008E218 = { - CreatedOnToolsVersion = 7.1.1; + 293AB3581E111F53004A4946 = { + CreatedOnToolsVersion = 8.2; + ProvisioningStyle = Automatic; + }; + 293AB3601E111F53004A4946 = { + CreatedOnToolsVersion = 8.2; + ProvisioningStyle = Automatic; }; }; }; - buildConfigurationList = 2DACECA31A794CD800FEC3CE /* Build configuration list for PBXProject "HexColors" */; + buildConfigurationList = 293AB31A1E111E68004A4946 /* Build configuration list for PBXProject "HexColors" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); - mainGroup = 2DACEC9F1A794CD800FEC3CE; - productRefGroup = 2DACECAA1A794CD800FEC3CE /* Products */; + mainGroup = 293AB3161E111E68004A4946; + productRefGroup = 293AB3201E111E68004A4946 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - 2DACECA81A794CD800FEC3CE /* HexColors */, - 2DACED071A794E0500FEC3CE /* HexColorsOSX */, - 8EB8367B1C46E8A80008E218 /* HexColorsTests */, + 293AB33B1E111F0B004A4946 /* HexColors-iOS */, + 293AB3431E111F0B004A4946 /* HexColors-iOSTests */, + 293AB3581E111F53004A4946 /* HexColors-macOS */, + 293AB3601E111F53004A4946 /* HexColors-macOSTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 2DACECA71A794CD800FEC3CE /* Resources */ = { + 293AB33A1E111F0B004A4946 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 293AB3421E111F0B004A4946 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 2DACED061A794E0500FEC3CE /* Resources */ = { + 293AB3571E111F53004A4946 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 8EB8367A1C46E8A80008E218 /* Resources */ = { + 293AB35F1E111F53004A4946 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -275,46 +328,59 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 2DACECA41A794CD800FEC3CE /* Sources */ = { + 293AB3371E111F0B004A4946 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 2DACED261A794E1B00FEC3CE /* HexColors.m in Sources */, + 293AB3531E111F20004A4946 /* HexColors.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 2DACED031A794E0500FEC3CE /* Sources */ = { + 293AB3401E111F0B004A4946 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 2DACED271A794E1B00FEC3CE /* HexColors.m in Sources */, + 293AB34A1E111F0B004A4946 /* HexColors_iOSTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 8EB836781C46E8A80008E218 /* Sources */ = { + 293AB3541E111F53004A4946 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8EB836871C46E9830008E218 /* HexColors.m in Sources */, - 8EB8367F1C46E8A80008E218 /* HexColorsTests.m in Sources */, + 293AB3701E111F5A004A4946 /* HexColors.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 293AB35D1E111F53004A4946 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 293AB3671E111F53004A4946 /* HexColors_macOSTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 8EB836831C46E8A80008E218 /* PBXTargetDependency */ = { + 293AB3471E111F0B004A4946 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 2DACECA81A794CD800FEC3CE /* HexColors */; - targetProxy = 8EB836821C46E8A80008E218 /* PBXContainerItemProxy */; + target = 293AB33B1E111F0B004A4946 /* HexColors-iOS */; + targetProxy = 293AB3461E111F0B004A4946 /* PBXContainerItemProxy */; + }; + 293AB3641E111F53004A4946 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 293AB3581E111F53004A4946 /* HexColors-macOS */; + targetProxy = 293AB3631E111F53004A4946 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 2DACECBD1A794CD800FEC3CE /* Debug */ = { + 293AB32F1E111E68004A4946 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -322,44 +388,49 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.1; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; }; name = Debug; }; - 2DACECBE1A794CD800FEC3CE /* Release */ = { + 293AB3301E111E68004A4946 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -367,174 +438,236 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 1; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.1; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; }; name = Release; }; - 2DACECC01A794CD800FEC3CE /* Debug */ = { + 293AB34E1E111F0B004A4946 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = HexColors/Info.plist; + INFOPLIST_FILE = "HexColors-iOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = "de.mariuslandwehr.HexColors-iOS"; + PRODUCT_NAME = HexColors; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; }; name = Debug; }; - 2DACECC11A794CD800FEC3CE /* Release */ = { + 293AB34F1E111F0B004A4946 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = HexColors/Info.plist; + INFOPLIST_FILE = "HexColors-iOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = "de.mariuslandwehr.HexColors-iOS"; + PRODUCT_NAME = HexColors; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 293AB3511E111F0B004A4946 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + INFOPLIST_FILE = "HexColors-iOSTests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "de.mariuslandwehr.HexColors-iOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 293AB3521E111F0B004A4946 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + INFOPLIST_FILE = "HexColors-iOSTests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "de.mariuslandwehr.HexColors-iOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Release; }; - 2DACED1C1A794E0500FEC3CE /* Debug */ = { + 293AB36B1E111F53004A4946 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = HexColorsOSX/Info.plist; + INFOPLIST_FILE = "HexColors-macOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.10; - PRODUCT_NAME = "$(TARGET_NAME)"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = "de.mariuslandwehr.HexColors-macOS"; + PRODUCT_NAME = HexColors; SDKROOT = macosx; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; }; name = Debug; }; - 2DACED1D1A794E0500FEC3CE /* Release */ = { + 293AB36C1E111F53004A4946 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; - INFOPLIST_FILE = HexColorsOSX/Info.plist; + INFOPLIST_FILE = "HexColors-macOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.10; - PRODUCT_NAME = "$(TARGET_NAME)"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = "de.mariuslandwehr.HexColors-macOS"; + PRODUCT_NAME = HexColors; SDKROOT = macosx; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; }; name = Release; }; - 8EB836841C46E8A80008E218 /* Debug */ = { + 293AB36E1E111F53004A4946 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = HexColorsTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.1; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = de.MariusLandwehr.HexColorsTests; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = "HexColors-macOSTests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = "de.mariuslandwehr.HexColors-macOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_VERSION = 3.0; }; name = Debug; }; - 8EB836851C46E8A80008E218 /* Release */ = { + 293AB36F1E111F53004A4946 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = HexColorsTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.1; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = de.MariusLandwehr.HexColorsTests; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = "HexColors-macOSTests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = "de.mariuslandwehr.HexColors-macOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_VERSION = 3.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 2DACECA31A794CD800FEC3CE /* Build configuration list for PBXProject "HexColors" */ = { + 293AB31A1E111E68004A4946 /* Build configuration list for PBXProject "HexColors" */ = { isa = XCConfigurationList; buildConfigurations = ( - 2DACECBD1A794CD800FEC3CE /* Debug */, - 2DACECBE1A794CD800FEC3CE /* Release */, + 293AB32F1E111E68004A4946 /* Debug */, + 293AB3301E111E68004A4946 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 2DACECBF1A794CD800FEC3CE /* Build configuration list for PBXNativeTarget "HexColors" */ = { + 293AB34D1E111F0B004A4946 /* Build configuration list for PBXNativeTarget "HexColors-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( - 2DACECC01A794CD800FEC3CE /* Debug */, - 2DACECC11A794CD800FEC3CE /* Release */, + 293AB34E1E111F0B004A4946 /* Debug */, + 293AB34F1E111F0B004A4946 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 2DACED1B1A794E0500FEC3CE /* Build configuration list for PBXNativeTarget "HexColorsOSX" */ = { + 293AB3501E111F0B004A4946 /* Build configuration list for PBXNativeTarget "HexColors-iOSTests" */ = { isa = XCConfigurationList; buildConfigurations = ( - 2DACED1C1A794E0500FEC3CE /* Debug */, - 2DACED1D1A794E0500FEC3CE /* Release */, + 293AB3511E111F0B004A4946 /* Debug */, + 293AB3521E111F0B004A4946 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 8EB836861C46E8A80008E218 /* Build configuration list for PBXNativeTarget "HexColorsTests" */ = { + 293AB36A1E111F53004A4946 /* Build configuration list for PBXNativeTarget "HexColors-macOS" */ = { isa = XCConfigurationList; buildConfigurations = ( - 8EB836841C46E8A80008E218 /* Debug */, - 8EB836851C46E8A80008E218 /* Release */, + 293AB36B1E111F53004A4946 /* Debug */, + 293AB36C1E111F53004A4946 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 293AB36D1E111F53004A4946 /* Build configuration list for PBXNativeTarget "HexColors-macOSTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 293AB36E1E111F53004A4946 /* Debug */, + 293AB36F1E111F53004A4946 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; - rootObject = 2DACECA01A794CD800FEC3CE /* Project object */; + rootObject = 293AB3171E111E68004A4946 /* Project object */; } diff --git a/HexColors.xcodeproj/xcshareddata/xcschemes/HexColors.xcscheme b/HexColors.xcodeproj/xcshareddata/xcschemes/HexColors-iOS-Tests.xcscheme similarity index 72% rename from HexColors.xcodeproj/xcshareddata/xcschemes/HexColors.xcscheme rename to HexColors.xcodeproj/xcshareddata/xcschemes/HexColors-iOS-Tests.xcscheme index 292fc86..f16a2f9 100644 --- a/HexColors.xcodeproj/xcshareddata/xcschemes/HexColors.xcscheme +++ b/HexColors.xcodeproj/xcshareddata/xcschemes/HexColors-iOS-Tests.xcscheme @@ -1,6 +1,6 @@ - - - - @@ -47,9 +33,9 @@ skipped = "NO"> @@ -57,9 +43,9 @@ @@ -79,9 +65,9 @@ @@ -97,9 +83,9 @@ diff --git a/HexColors.xcodeproj/xcshareddata/xcschemes/HexColorsTests.xcscheme b/HexColors.xcodeproj/xcshareddata/xcschemes/HexColors-iOS.xcscheme similarity index 53% rename from HexColors.xcodeproj/xcshareddata/xcschemes/HexColorsTests.xcscheme rename to HexColors.xcodeproj/xcshareddata/xcschemes/HexColors-iOS.xcscheme index 905ce00..37a0324 100644 --- a/HexColors.xcodeproj/xcshareddata/xcschemes/HexColorsTests.xcscheme +++ b/HexColors.xcodeproj/xcshareddata/xcschemes/HexColors-iOS.xcscheme @@ -1,10 +1,26 @@ + + + + + + @@ -26,9 +42,9 @@ @@ -45,6 +61,15 @@ debugDocumentVersioning = "YES" debugServiceExtension = "internal" allowLocationSimulation = "YES"> + + + + @@ -54,6 +79,15 @@ savedToolIdentifier = "" useCustomWorkingDirectory = "NO" debugDocumentVersioning = "YES"> + + + + diff --git a/HexColors.xcodeproj/xcshareddata/xcschemes/HexColorsOSX.xcscheme b/HexColors.xcodeproj/xcshareddata/xcschemes/HexColors-macOS-Tests.xcscheme similarity index 64% rename from HexColors.xcodeproj/xcshareddata/xcschemes/HexColorsOSX.xcscheme rename to HexColors.xcodeproj/xcshareddata/xcschemes/HexColors-macOS-Tests.xcscheme index 7adbcd5..569fc71 100644 --- a/HexColors.xcodeproj/xcshareddata/xcschemes/HexColorsOSX.xcscheme +++ b/HexColors.xcodeproj/xcshareddata/xcschemes/HexColors-macOS-Tests.xcscheme @@ -1,9 +1,9 @@ - - - - + codeCoverageEnabled = "YES"> @@ -56,28 +43,31 @@ + + @@ -85,17 +75,17 @@ diff --git a/HexColors.xcodeproj/xcshareddata/xcschemes/HexColors-macOS.xcscheme b/HexColors.xcodeproj/xcshareddata/xcschemes/HexColors-macOS.xcscheme new file mode 100644 index 0000000..045d1d8 --- /dev/null +++ b/HexColors.xcodeproj/xcshareddata/xcschemes/HexColors-macOS.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HexColorsTests/HexColorsTests.m b/HexColorsTests/HexColorsTests.m deleted file mode 100644 index d62d0ee..0000000 --- a/HexColorsTests/HexColorsTests.m +++ /dev/null @@ -1,120 +0,0 @@ -// -// HexColorsTests.m -// HexColorsTests -// -// Created by Marius Landwehr on 13.01.16. -// Copyright © 2016 Reversebox. All rights reserved. -// - -#import -#import "HexColors.h" - -@interface HexColorsTests : XCTestCase - -@end - -@implementation HexColorsTests - -- (void)setUp { - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -- (void)testEmptyHexString { - - UIColor *nilColor = [UIColor hx_colorWithHexString:@""]; - - NSAssert(nilColor == nil, @"nilColor is not nil"); -} - -- (void)testEmptyHexStringRGBA { - - UIColor *nilColor = [UIColor hx_colorWithHexRGBAString:@""]; - - NSAssert(nilColor == nil, @"nilColor is not nil"); -} - -- (void)testInvalidHexStringLength { - - UIColor *falseColor = [UIColor hx_colorWithHexString:@"12345"]; - - NSAssert(falseColor == nil, @"String should not create a valid color"); -} - -- (void)testInvalidHexStringRGBSLength { - - UIColor *falseColor = [UIColor hx_colorWithHexRGBAString:@"12345"]; - - NSAssert(falseColor == nil, @"String should not create a valid color"); -} - -- (void)testLongRGBASyntaxWithHash { - - UIColor *whiteColor = [UIColor whiteColor]; - UIColor *whiteHexColor = [UIColor hx_colorWithHexRGBAString:@"#ffffffff"]; - - NSAssert(whiteColor != whiteHexColor, @"hexColor is not equal to the white color"); -} - -- (void)testShortSyntaxWithHash { - - UIColor *whiteColor = [UIColor whiteColor]; - UIColor *whiteHexColor = [UIColor hx_colorWithHexString:@"#fff"]; - - NSAssert(whiteColor != whiteHexColor, @"hexColor is not equal to the white color"); -} - -- (void)testShortRGBASyntaxWithHash { - - UIColor *whiteColor = [UIColor whiteColor]; - UIColor *whiteHexColor = [UIColor hx_colorWithHexRGBAString:@"#fff"]; - - NSAssert(whiteColor != whiteHexColor, @"hexColor is not equal to the white color"); -} - -- (void)testShortSyntaxWithoutHash { - - UIColor *whiteColor = [UIColor whiteColor]; - UIColor *whiteHexColor = [UIColor hx_colorWithHexString:@"fff"]; - - NSAssert(whiteColor != whiteHexColor, @"hexColor is not equal to white color"); -} - -- (void)testShortRGBASyntaxWithoutHash { - - UIColor *whiteColor = [UIColor whiteColor]; - UIColor *whiteHexColor = [UIColor hx_colorWithHexRGBAString:@"fff"]; - - NSAssert(whiteColor != whiteHexColor, @"hexColor is not equal to white color"); -} - -- (void)testShortSyntaxWithHashAndAlpha { - - UIColor *whiteColorAlpha = [UIColor colorWithWhite:1 alpha:0.533333]; - UIColor *whiteHexColorAlpha = [UIColor hx_colorWithHexString:@"8fff"]; - - NSAssert(whiteColorAlpha != whiteHexColorAlpha, @"hexColor is not equal to white alpha hexColor"); -} - -- (void)testShortRGBASyntaxWithHashAndAlpha { - - UIColor *whiteColorAlpha = [UIColor colorWithWhite:1 alpha:0.533333]; - UIColor *whiteHexColorAlpha = [UIColor hx_colorWithHexRGBAString:@"8fff"]; - - NSAssert(whiteColorAlpha != whiteHexColorAlpha, @"hexColor is not equal to white alpha hexColor"); -} - -- (void)testRGBColor { - - UIColor *greyColor = [UIColor colorWithWhite:0.5 alpha:1]; - UIColor *rgbColor = [UIColor hx_colorWith8BitRed:127.5 green:127.5 blue:127.5]; - - NSAssert(greyColor != rgbColor, @"hexColor is not equal to the grey color"); -} - -@end diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..252cae5 --- /dev/null +++ b/Package.swift @@ -0,0 +1,19 @@ +// +// HexColors.swift +// +// Created by Marius Landwehr on 28.12.16. +// The MIT License (MIT) +// Copyright (c) 2016 Marius Landwehr marius.landwehr@gmail.com +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +import PackageDescription + +let package = Package( + name: "HexColors" +) diff --git a/README.md b/README.md index 592aa37..b1ab5a2 100644 --- a/README.md +++ b/README.md @@ -1,76 +1,112 @@ -HexColors +

+ HexColors +

========================= -![Badge w/ Version](https://cocoapod-badges.herokuapp.com/v/HexColors/badge.png) -![Badge w/ Version](https://travis-ci.org/mRs-/HexColors.svg) -![Badge w/ Version](https://cocoapod-badges.herokuapp.com/p/HexColors/badge.png) +[![Platform](https://img.shields.io/badge/platform-iOS%20%7C%20watchOS%20%7C%20tvOS%20%7C%20macOS-lightgrey.svg)](https://github.com/mrs-/HexColors) +[![Xcode](https://img.shields.io/badge/Xcode-8.0-blue.svg)](https://developer.apple.com/xcode) +[![Swift](https://img.shields.io/badge/Swift-3.0-orange.svg)](https://swift.org) +![Downloads Month](https://img.shields.io/cocoapods/dm/HexColors.svg) +![Cocoapods](https://cocoapod-badges.herokuapp.com/v/HexColors/badge.png) +[![Build Status](https://travis-ci.org/mRs-/HexColors.svg?branch=master)](https://travis-ci.org/mrs-/HexColors) +[![codecov](https://codecov.io/gh/mRs-/HexColors/branch/master/graph/badge.svg)](https://codecov.io/gh/mRs-/HexColors) -HexColors is drop in category for HexColor Support for NSColor and UIColor. Support for HexColors with prefixed # and without. +HexColors is an extension for UIColor and NSColor to support for creating colors from a hex string like #FF0088 or 8844FF and back to a String. Completely rewritten in Swift 3! -#RELEASE 3.0.0 -Popular request was to pre-fix the function calls because of better support of different libraries and dependencies. All functions are now prefixed with hx_ +If you want to use this in Objective-C jump to the 4.X version tag. -#Example iOS -##objective-c## -``` objective-c -// with hash -UIColor *colorWithHex = [UIColor hx_colorWithHexString:@"#ff8942"]; +#RELEASE 5.0.0 +Completely new and fresh in Swift 3. -// without hash -UIColor *secondColorWithHex = [UIColor hx_colorWithHexString:@"ff8942"]; +#Examples +How to use HexColors in the different systems. -// short handling -UIColor *shortColorWithHex = [UIColor hx_colorWithHexString:@"fff"]; -``` -##swift## -``` swift -// with hash -let colorWithHex = UIColor.hx_colorWithHexString("#ff8942") +##iOS / watchOS / tvOS -// without hash -let secondColorWithHex = UIColor.hx_colorWithHexString("ff8942") +### Generating UIColors -// short handling -let shortColorWithHex = UIColor.hx_colorWithHexString("fff") +``` swift +let colorWithHex = UIColor("#ff8942") +let colorWithoutHex = UIColor("ff8942") +let colorWithHexAndAlhpa = UIColor("#ff8942DF") +let colorWithoutHexAndAlhpa = UIColor("ff8942DF") +let shortColorWithHex = UIColor("#fff") +let shortColorWithoutHex = UIColor("fff") +let shortColorWithHexAndAlpha = UIColor("#FFFD") +let shortColorWithoutHexAndAlpha = UIColor("#FFFD") ``` -#Example Mac OS X -``` objective-c -// with hash -NSColor *colorWithHex = [NSColor hx_colorWithHexString:@"#ff8942"]; +### Generating Hex Strings from UIColor +``` swift +let colorWithHex = UIColor("#ff8942") +let stringFromColor = colorWithHex.hex +``` -// wihtout hash -NSColor *secondColorWithHex = [NSColor hx_colorWithHexString:@"ff8942"]; +##macOS -// short handling -NSColor *shortColorWithHex = [NSColor hx_colorWithHexString:@"fff"]; -``` -##swift## +### Generating NSColor ``` swift -// with hash -let colorWithHex = NSColor.hx_colorWithHexString("#ff8942") - -// without hash -let secondColorWithHex = NSColor.hx_colorWithHexString("ff8942") +let colorWithHex = NSColor("#ff8942") +let colorWithoutHex = NSColor("ff8942") +let colorWithHexAndAlhpa = NSColor("#ff8942DF") +let colorWithoutHexAndAlhpa = NSColor("ff8942DF") +let shortColorWithHex = NSColor("#fff") +let shortColorWithoutHex = NSColor("fff") +let shortColorWithHexAndAlpha = NSColor("#FFFD") +let shortColorWithoutHexAndAlpha = NSColor("#FFFD") +``` -// short handling -let shortColorWithHex = NSColor.hx_colorWithHexString("fff") +### Generating Hex Strings from NSColor +``` swift +let colorWithHex = NSColor("#ff8942") +let stringFromColor = colorWithHex.hex ``` #Installation -* `#import "HexColors.h"` where you want to use easy as pie HexColors -* `pod install HexColors` -* or just drag the source files in your project ##Requirements -HexColors requires [iOS 5.0](http://developer.apple.com/library/ios/#releasenotes/General/WhatsNewIniPhoneOS/Articles/iPhoneOS4.html) and above, and Mac OS X 10.6 +HexColors requires **>= iOS 8.0** and **>=macOS 10.9**. + +## Cocoapods +Add HexColors to your Podfile: +``` ruby +pod 'HexColors' +``` +* `pod install HexColors` + +## Carthage +Add HexColors to your Cartfile: +``` +github "mRs-/HexColors" +``` + +## Swift Package Manager +To work with the Swift Package Manager you need to add a Package.swift file and defining your package. + +``` swift +import PackageDescription + +let package = Package( + name: "YourPackageName", + dependencies: [ + .Package(url: "htthttps://github.com/mRs-/HexColors", majorVersion: 5), + ] +) +``` + +Then execute the Swift Package Manager with the following Shell commands: +``` bash +swift build +.build/debug/YourPackageName +``` -##Credits -HexColors was created by [Marius Landwehr](https://github.com/mRs-) because of the pain recalculating Hex values to RGB. +## Manual +Simply just drag and drop the HexColors.swift in your project. -HexColors was ported to Mac OS X by [holgersindbaek](https://github.com/holgersindbaek). +#Credits +HexColors was created by [Marius Landwehr](https://github.com/mRs-) because of the pain to create Colors from a API (mostly hex) converting to a UI/NSColor. -##Creator +#Creator [Marius Landwehr](https://github.com/mRs-) [@mariusLAN](https://twitter.com/mariusLAN) -##License +#License HexColors is available under the MIT license. See the LICENSE file for more info. diff --git a/Sources/HexColors.swift b/Sources/HexColors.swift new file mode 100644 index 0000000..842e841 --- /dev/null +++ b/Sources/HexColors.swift @@ -0,0 +1,149 @@ +// +// HexColors.swift +// +// Created by Marius Landwehr on 25.12.16. +// The MIT License (MIT) +// Copyright (c) 2016 Marius Landwehr marius.landwehr@gmail.com +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#if os(iOS) || os(watchOS) || os(tvOS) + import UIKit + public typealias HexColor = UIColor +#else + import Cocoa + public typealias HexColor = NSColor +#endif + +public extension HexColor { + typealias Hex = String + + convenience init?(_ hex: Hex, alpha: CGFloat? = nil) { + + guard let hexType = Type(from: hex), let components = hexType.components() else { + return nil + } + + #if os(iOS) || os(watchOS) || os(tvOS) + self.init(red: components.red, green: components.green, blue: components.blue, alpha: alpha ?? components.alpha) + #else + self.init(calibratedRed: components.red, green: components.green, blue: components.blue, alpha: alpha ?? components.alpha) + #endif + } + + /// The string hex value representation of the current color + var hex: Hex { + var r: CGFloat = 0, g: CGFloat = 0, b: CGFloat = 0, a: CGFloat = 0, rgb: Int + getRed(&r, green: &g, blue: &b, alpha: &a) + + if a == 1 { // no alpha value set, we are returning the short version + rgb = (Int)(r*255)<<16 | (Int)(g*255)<<8 | (Int)(r*255)<<0 + } else { + rgb = (Int)(r*255)<<24 | (Int)(g*255)<<16 | (Int)(r*255)<<8 | (Int)(a*255)<<0 + } + + return String(format: "#%06x", rgb) + } + + private enum `Type` { + + case RGBshort(rgb: Hex) + case RGBshortAlpha(rgba: Hex) + case RGB(rgb: Hex) + case RGBA(rgba: Hex) + + init?(from hex: Hex) { + + var hexString = hex + hexString.removeHashIfNecessary() + + guard let t = Type.transform(hex: hexString) else { + return nil + } + + self = t + } + + static func transform(hex string: Hex) -> Type? { + switch string.characters.count { + case 3: + return .RGBshort(rgb: string) + case 4: + return .RGBshortAlpha(rgba: string) + case 6: + return .RGB(rgb: string) + case 8: + return .RGBA(rgba: string) + default: + return nil + } + } + + var value: Hex { + switch self { + case .RGBshort(let rgb): + return rgb + case .RGBshortAlpha(let rgba): + return rgba + case .RGB(let rgb): + return rgb + case .RGBA(let rgba): + return rgba + } + } + + typealias rgbComponents = (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) + func components() -> rgbComponents? { + + var hexValue: UInt32 = 0 + guard Scanner(string: value).scanHexInt32(&hexValue) else { + return nil + } + + let r, g, b, a, divisor: CGFloat + + switch self { + case .RGBshort(_): + divisor = 15 + r = CGFloat((hexValue & 0xF00) >> 8) / divisor + g = CGFloat((hexValue & 0x0F0) >> 4) / divisor + b = CGFloat( hexValue & 0x00F) / divisor + a = 1 + case .RGBshortAlpha(_): + divisor = 15 + r = CGFloat((hexValue & 0xF000) >> 12) / divisor + g = CGFloat((hexValue & 0x0F00) >> 8) / divisor + b = CGFloat((hexValue & 0x00F0) >> 4) / divisor + a = CGFloat( hexValue & 0x000F) / divisor + case .RGB(_): + divisor = 255 + r = CGFloat((hexValue & 0xFF0000) >> 16) / divisor + g = CGFloat((hexValue & 0x00FF00) >> 8) / divisor + b = CGFloat( hexValue & 0x0000FF) / divisor + a = 1 + case .RGBA(_): + divisor = 255 + r = CGFloat((hexValue & 0xFF000000) >> 24) / divisor + g = CGFloat((hexValue & 0x00FF0000) >> 16) / divisor + b = CGFloat((hexValue & 0x0000FF00) >> 8) / divisor + a = CGFloat( hexValue & 0x000000FF) / divisor + } + + return (red: r, green: g, blue: b, alpha: a) + } + } +} + +private extension String { + + mutating func removeHashIfNecessary() { + if hasPrefix("#") { + self = replacingOccurrences(of: "#", with: "") + } + } +}