diff --git a/Chameleon.xcodeproj/project.pbxproj b/Chameleon.xcodeproj/project.pbxproj index 271dce6..66ef52e 100755 --- a/Chameleon.xcodeproj/project.pbxproj +++ b/Chameleon.xcodeproj/project.pbxproj @@ -390,7 +390,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0900; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1120; ORGANIZATIONNAME = "Vicc Alexander"; TargetAttributes = { 0C8DABB01C07B5EA00B28FE2 = { @@ -411,7 +411,7 @@ }; buildConfigurationList = 240093F21BB4517400932727 /* Build configuration list for PBXProject "Chameleon" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -614,6 +614,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -622,12 +623,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 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_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -670,6 +673,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -678,12 +682,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 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_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -734,7 +740,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -755,7 +761,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.viccalexander.Chameleon; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -780,7 +786,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.viccalexander.ChameleonDemo-Swift"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -805,7 +811,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.viccalexander.ChameleonDemo-Swift"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -819,7 +825,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.viccalexander.ChameleonDemo; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -832,7 +838,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.viccalexander.ChameleonDemo; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Chameleon.xcodeproj/xcshareddata/xcschemes/Chameleon.xcscheme b/Chameleon.xcodeproj/xcshareddata/xcschemes/Chameleon.xcscheme index a813637..aecf6af 100755 --- a/Chameleon.xcodeproj/xcshareddata/xcschemes/Chameleon.xcscheme +++ b/Chameleon.xcodeproj/xcshareddata/xcschemes/Chameleon.xcscheme @@ -1,6 +1,6 @@ - - - - Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { return true } diff --git a/ChameleonDemo-Swift/FirstViewController.swift b/ChameleonDemo-Swift/FirstViewController.swift index 01ef1aa..eac6a8b 100644 --- a/ChameleonDemo-Swift/FirstViewController.swift +++ b/ChameleonDemo-Swift/FirstViewController.swift @@ -55,11 +55,11 @@ class FirstViewController: UITableViewController { // MARK: Chameleon related func initChameleonColors() { - let randomFlatColor = UIColor.randomFlat + let randomFlatColor = UIColor.randomFlat() let randomFlatColorContract = ContrastColorOf(randomFlatColor, returnFlat: true) // Nav bar navigationController?.navigationBar.barTintColor = randomFlatColor - navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: randomFlatColorContract] + navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: randomFlatColorContract] // Tab bar tabBarController?.tabBar.barTintColor = randomFlatColor tabBarController?.tabBar.tintColor = randomFlatColorContract @@ -87,9 +87,9 @@ class FirstViewController: UITableViewController { darkerColorLabel.text = "Aa \u{25A0}" darkerColorLabel.textColor = randomFlatColor.darken(byPercentage: 0.5) // Gradient color - let firstRandomColor = UIColor.randomFlat - let secondRandomColor = UIColor.randomFlat - let thirdRandomColor = UIColor.randomFlat + let firstRandomColor = UIColor.randomFlat() + let secondRandomColor = UIColor.randomFlat() + let thirdRandomColor = UIColor.randomFlat() let gradientColor = GradientColor(.leftToRight, frame: gradientColorLabel.frame, colors: [firstRandomColor, secondRandomColor, thirdRandomColor]) let gradientColorLargeFrame = GradientColor(.leftToRight, frame: gradientWithContrastLabel.frame, colors: [firstRandomColor, secondRandomColor, thirdRandomColor]) gradientColorLabel.text = "Aa \u{25A0}" @@ -115,11 +115,11 @@ class FirstViewController: UITableViewController { // Generate a random color func generateRandomColor() -> UIColor { - let red = Float(arc4random_uniform(256))/255.0 - let green = Float(arc4random_uniform(256))/255.0 - let blue = Float(arc4random_uniform(256))/255.0 + let red = CGFloat(arc4random_uniform(256))/255.0 + let green = CGFloat(arc4random_uniform(256))/255.0 + let blue = CGFloat(arc4random_uniform(256))/255.0 - return UIColor(colorLiteralRed: red, green: green, blue: blue, alpha: 1.0) + return UIColor(red: red, green: green, blue: blue, alpha: 1.0) } } diff --git a/ChameleonDemo-Swift/SecondViewController.swift b/ChameleonDemo-Swift/SecondViewController.swift index a0f1246..565679b 100644 --- a/ChameleonDemo-Swift/SecondViewController.swift +++ b/ChameleonDemo-Swift/SecondViewController.swift @@ -42,7 +42,7 @@ class SecondViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() - navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: tabBarController?.tabBar.tintColor ?? UIColor.gray] + navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: tabBarController?.tabBar.tintColor ?? UIColor.gray] navigationController?.navigationBar.barTintColor = tabBarController?.tabBar.barTintColor ?? UIColor.lightGray sampleOneImageView.image = #imageLiteral(resourceName: "SampleImageOne") sampleTwoImageView.image = #imageLiteral(resourceName: "SampleImageTwo") @@ -54,7 +54,7 @@ class SecondViewController: UITableViewController { } override func viewWillAppear(_ animated: Bool) { - navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: tabBarController?.tabBar.tintColor ?? UIColor.gray] + navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: tabBarController?.tabBar.tintColor ?? UIColor.gray] navigationController?.navigationBar.barTintColor = tabBarController?.tabBar.barTintColor ?? UIColor.lightGray } diff --git a/ChameleonDemo/AppDelegate.swift b/ChameleonDemo/AppDelegate.swift index 3efbb64..5ff1466 100755 --- a/ChameleonDemo/AppDelegate.swift +++ b/ChameleonDemo/AppDelegate.swift @@ -14,11 +14,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { + public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { - Chameleon.setGlobalThemeUsingPrimaryColor(.flatPlum, - withSecondaryColor: .flatBlue, - andContentStyle: .contrast) + Chameleon.setGlobalThemeUsingPrimaryColor(.flatPlum(), + withSecondaryColor: .flatBlue(), + andContentStyle: .contrast) return true } diff --git a/Pod/Classes/Objective-C/UIColor+Chameleon.m b/Pod/Classes/Objective-C/UIColor+Chameleon.m index 5c9ae8a..4f60eca 100755 --- a/Pod/Classes/Objective-C/UIColor+Chameleon.m +++ b/Pod/Classes/Objective-C/UIColor+Chameleon.m @@ -933,6 +933,7 @@ - (void)getRGBAComponents:(CGFloat[4])rgba { break; } + case kCGColorSpaceModelXYZ: case kCGColorSpaceModelCMYK: case kCGColorSpaceModelDeviceN: case kCGColorSpaceModelIndexed: diff --git a/Pod/Classes/Swift/ChameleonShorthand.swift b/Pod/Classes/Swift/ChameleonShorthand.swift index a33d633..5f612c1 100755 --- a/Pod/Classes/Swift/ChameleonShorthand.swift +++ b/Pod/Classes/Swift/ChameleonShorthand.swift @@ -49,7 +49,7 @@ public func ComplementaryFlatColorOf(_ color: UIColor) -> UIColor { - returns: A flat UIColor object in the HSB colorspace. */ -public func RandomFlatColorWithShade(_ shade: UIShadeStyle) -> UIColor { +public func RandomFlatColorWithShade(shade: UIShadeStyle) -> UIColor { return UIColor(randomFlatColorOf: shade) } @@ -78,7 +78,7 @@ public func GradientColor(_ gradientStyle: UIGradientStyle, frame: CGRect, color return UIColor(gradientStyle: gradientStyle, withFrame: frame, andColors: colors) } -public func HexColor(_ hexString: String, _ alpha: CGFloat = 1.0) -> UIColor? { +public func HexColor(hexString: String, _ alpha: CGFloat = 1.0) -> UIColor? { return UIColor(hexString: hexString, withAlpha: alpha) } @@ -106,7 +106,7 @@ Generates and creates an array of 5 color objects in the HSB colorspace from the - returns: An array of 5 color objects in the HSB colorspace. */ -public func ColorSchemeOf(_ colorSchemeType:ColorScheme, color:UIColor, isFlatScheme:Bool) -> [UIColor] { +public func ColorSchemeOf(colorSchemeType: ColorScheme, color: UIColor, isFlatScheme: Bool) -> [UIColor] { return NSArray(ofColorsWith: colorSchemeType, using: color, withFlatScheme: isFlatScheme) as! [UIColor] } @@ -132,7 +132,7 @@ Returns a randomly generated flat color object whose alpha value is 1.0. - returns: A flat UIColor object in the HSB colorspace. */ public func RandomFlatColor() -> UIColor { - return UIColor.randomFlat + return UIColor.randomFlat() } public func ClearColor() -> UIColor { @@ -143,195 +143,195 @@ public func ClearColor() -> UIColor { // MARK: - Light Shades Shorthand public func FlatBlack() -> UIColor { - return UIColor.flatBlack + return UIColor.flatBlack() } public func FlatBlue() -> UIColor { - return UIColor.flatBlue + return UIColor.flatBlue() } public func FlatBrown() -> UIColor { - return UIColor.flatBrown + return UIColor.flatBrown() } public func FlatCoffee() -> UIColor { - return UIColor.flatCoffee + return UIColor.flatCoffee() } public func FlatForestGreen() -> UIColor { - return UIColor.flatForestGreen + return UIColor.flatForestGreen() } public func FlatGray() -> UIColor { - return UIColor.flatGray + return UIColor.flatGray() } public func FlatGreen() -> UIColor { - return UIColor.flatGreen + return UIColor.flatGreen() } public func FlatLime() -> UIColor { - return UIColor.flatLime + return UIColor.flatLime() } public func FlatMagenta() -> UIColor { - return UIColor.flatMagenta + return UIColor.flatMagenta() } public func FlatMaroon() -> UIColor { - return UIColor.flatMaroon + return UIColor.flatMaroon() } public func FlatMint() -> UIColor { - return UIColor.flatMint + return UIColor.flatMint() } public func FlatNavyBlue() -> UIColor { - return UIColor.flatNavyBlue + return UIColor.flatNavyBlue() } public func FlatOrange() -> UIColor { - return UIColor.flatOrange + return UIColor.flatOrange() } public func FlatPink() -> UIColor { - return UIColor.flatPink + return UIColor.flatPink() } public func FlatPlum() -> UIColor { - return UIColor.flatPlum + return UIColor.flatPlum() } public func FlatPowderBlue() -> UIColor { - return UIColor.flatPowderBlue + return UIColor.flatPowderBlue() } public func FlatPurple() -> UIColor { - return UIColor.flatPurple + return UIColor.flatPurple() } public func FlatRed() -> UIColor { - return UIColor.flatRed + return UIColor.flatRed() } public func FlatSand() -> UIColor { - return UIColor.flatSand + return UIColor.flatSand() } public func FlatSkyBlue() -> UIColor { - return UIColor.flatSkyBlue + return UIColor.flatSkyBlue() } public func FlatTeal() -> UIColor { - return UIColor.flatTeal + return UIColor.flatTeal() } public func FlatWatermelon() -> UIColor { - return UIColor.flatWatermelon + return UIColor.flatWatermelon() } public func FlatWhite() -> UIColor { - return UIColor.flatWhite + return UIColor.flatWhite() } public func FlatYellow() -> UIColor { - return UIColor.flatYellow + return UIColor.flatYellow() } // MARK: - Chameleon - Dark Shades Shorthand public func FlatBlackDark() -> UIColor { - return UIColor.flatBlackDark + return UIColor.flatBlackDark() } public func FlatBlueDark() -> UIColor { - return UIColor.flatBlueDark + return UIColor.flatBlueDark() } public func FlatBrownDark() -> UIColor { - return UIColor.flatBrownDark + return UIColor.flatBrownDark() } public func FlatCoffeeDark() -> UIColor { - return UIColor.flatCoffeeDark + return UIColor.flatCoffeeDark() } public func FlatForestGreenDark() -> UIColor { - return UIColor.flatForestGreenDark + return UIColor.flatForestGreenDark() } public func FlatGrayDark() -> UIColor { - return UIColor.flatGrayDark + return UIColor.flatGrayDark() } public func FlatGreenDark() -> UIColor { - return UIColor.flatGreenDark + return UIColor.flatGreenDark() } public func FlatLimeDark() -> UIColor { - return UIColor.flatLimeDark + return UIColor.flatLimeDark() } public func FlatMagentaDark() -> UIColor { - return UIColor.flatMagentaDark + return UIColor.flatMagentaDark() } public func FlatMaroonDark() -> UIColor { - return UIColor.flatMaroonDark + return UIColor.flatMaroonDark() } public func FlatMintDark() -> UIColor { - return UIColor.flatMintDark + return UIColor.flatMintDark() } public func FlatNavyBlueDark() -> UIColor { - return UIColor.flatNavyBlueDark + return UIColor.flatNavyBlueDark() } public func FlatOrangeDark() -> UIColor { - return UIColor.flatOrangeDark + return UIColor.flatOrangeDark() } public func FlatPinkDark() -> UIColor { - return UIColor.flatPinkDark + return UIColor.flatPinkDark() } public func FlatPlumDark() -> UIColor { - return UIColor.flatPlumDark + return UIColor.flatPlumDark() } public func FlatPowderBlueDark() -> UIColor { - return UIColor.flatPowderBlueDark + return UIColor.flatPowderBlueDark() } public func FlatPurpleDark() -> UIColor { - return UIColor.flatPurpleDark + return UIColor.flatPurpleDark() } public func FlatRedDark() -> UIColor { - return UIColor.flatRedDark + return UIColor.flatRedDark() } public func FlatSandDark() -> UIColor { - return UIColor.flatSandDark + return UIColor.flatSandDark() } public func FlatSkyBlueDark() -> UIColor { - return UIColor.flatSkyBlueDark + return UIColor.flatSkyBlueDark() } public func FlatTealDark() -> UIColor { - return UIColor.flatTealDark + return UIColor.flatTealDark() } public func FlatWatermelonDark() -> UIColor { - return UIColor.flatWatermelonDark + return UIColor.flatWatermelonDark() } public func FlatWhiteDark() -> UIColor { - return UIColor.flatWhiteDark + return UIColor.flatWhiteDark() } public func FlatYellowDark() -> UIColor { - return UIColor.flatYellowDark + return UIColor.flatYellowDark() } diff --git a/README.md b/README.md index 78008ac..56e2ea3 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,15 @@ Downloads Apps Platform: iOS 8+ - Language: Swift 3 + Language: Swift 5 Carthage compatible CocoaPods compatible License: MIT

-## Swift 3 +## Swift 5 -To use the Swift 3 version, add this to your Podfile (until 2.2 or higher is released): +To use the Swift 5 version: ```ruby pod 'ChameleonFramework/Swift', :git => 'https://github.com/ViccAlexander/Chameleon.git' ``` @@ -159,8 +159,6 @@ All methods, properties, and types available in Chameleon are documented below. ### Installation -###### Note: Swift 3 version maintained in a separate branch until it's release. - #### CocoaPods Installation Chameleon is now available on [CocoaPods](http://cocoapods.org). Simply add the following to your project Podfile, and you'll be good to go.