Skip to content

Commit

Permalink
Merge branch 'Swift-2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
yeahdongcn committed Sep 19, 2016
2 parents 01df802 + 1d44ac3 commit 3f56cf2
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c

osx_image: xcode7.3
osx_image: xcode8

script: 'sh Scripts/ci.sh'
20 changes: 19 additions & 1 deletion HEXColor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,20 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = P.D.Q.;
TargetAttributes = {
43BCBCB51C51BA3D00205107 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
};
AA06B5051BC225210049FE14 = {
CreatedOnToolsVersion = 7.0.1;
LastSwiftMigration = 0800;
};
AA06B50F1BC225210049FE14 = {
CreatedOnToolsVersion = 7.0.1;
LastSwiftMigration = 0800;
};
};
};
Expand Down Expand Up @@ -292,6 +295,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BITCODE_GENERATION_MODE = bitcode;
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -303,6 +307,7 @@
PRODUCT_NAME = HEXColor;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 2.3;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.1;
};
Expand All @@ -313,6 +318,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BITCODE_GENERATION_MODE = bitcode;
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -324,6 +330,7 @@
PRODUCT_NAME = HEXColor;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 2.3;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.1;
};
Expand All @@ -342,8 +349,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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";
Expand Down Expand Up @@ -390,8 +399,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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";
Expand All @@ -411,6 +422,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -423,6 +435,7 @@
buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -435,6 +448,7 @@
PRODUCT_NAME = HEXColor;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 2.3;
};
name = Debug;
};
Expand All @@ -443,6 +457,7 @@
buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -454,6 +469,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.pdq.HEXColor;
PRODUCT_NAME = HEXColor;
SKIP_INSTALL = YES;
SWIFT_VERSION = 2.3;
};
name = Release;
};
Expand All @@ -464,6 +480,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.pdq.HEXColorTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 2.3;
};
name = Debug;
};
Expand All @@ -474,6 +491,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.pdq.HEXColorTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 2.3;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
8 changes: 0 additions & 8 deletions HEXColor/UIColorExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,4 @@ extension UIColor {
return String(format: "#%02X%02X%02X", Int(r * 255), Int(g * 255), Int(b * 255))
}
}

public override var description: String {
return self.hexString(true)
}

public override var debugDescription: String {
return self.hexString(true)
}
}
22 changes: 5 additions & 17 deletions HEXColorTests/HEXColorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -293,21 +293,14 @@ class HEXColorTests: XCTestCase {
XCTAssertEqual("#AABBCCDD", hexColor.hexString(true))
}

// MARK: - Desc

func testDesc() {
let color = UIColor(red: CGFloat(0x22 / 255.0), green: CGFloat(0x44 / 255.0), blue: CGFloat(0x66 / 255.0), alpha: CGFloat(0x88 / 255.0))
XCTAssertEqual("#22446688", color.description)
XCTAssertEqual("#22446688", color.debugDescription)

let hexColor = UIColor(rgba: "#AABBCCDD", defaultColor: UIColor.yellowColor());
XCTAssertEqual("#AABBCCDD", hexColor.description)
XCTAssertEqual("#AABBCCDD", hexColor.debugDescription)
}

}

extension UIColor {
private func toUInt8(value: CGFloat) -> UInt8 {
let multiplier = CGFloat(255)
return UInt8(value * multiplier)
}

private func rgba() -> (red: UInt8, green: UInt8, blue: UInt8, alpha: UInt8) {
var red: CGFloat = 0
var green: CGFloat = 0
Expand All @@ -317,8 +310,3 @@ extension UIColor {
return (toUInt8(red), toUInt8(green), toUInt8(blue), toUInt8(alpha))
}
}

private func toUInt8(value: CGFloat) -> UInt8 {
let multiplier = CGFloat(255)
return UInt8(value * multiplier)
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>

UIColor+Hex, now Swift.
[![Build Status](https://travis-ci.org/yeahdongcn/UIColor-Hex-Swift.svg?branch=master)](https://travis-ci.org/yeahdongcn/UIColor-Hex-Swift)
[![Build Status](https://travis-ci.org/yeahdongcn/UIColor-Hex-Swift.svg?branch=Swift-2.3)](https://travis-ci.org/yeahdongcn/UIColor-Hex-Swift)
=================
Convenience method for creating autoreleased color using RGBA hex string.

Expand Down

0 comments on commit 3f56cf2

Please sign in to comment.