Skip to content

Commit

Permalink
Updated Kumi for Swift 4
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultKlein committed Oct 25, 2017
1 parent cc08fde commit d77d450
Show file tree
Hide file tree
Showing 53 changed files with 341 additions and 1,024 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ playground.xcworkspace
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
Pods/

# Carthage
#
Expand Down
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
4.0
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# # * https://github.com/supermarin/xcpretty#usage
#
language: objective-c
osx_image: xcode8.1
osx_image: xcode9.0
cache: cocoapods
env:
- SWIFT_VERSION=3.0
- SWIFT_VERSION=4.0
podfile: Podfile
before_install:
#- gem install cocoapods # Since Travis is not always on latest version
Expand All @@ -15,6 +15,7 @@ before_install:
- gem install bundler
- bundle install
- pod repo update
- pod deintegrate
- pod install
script:
- set -o pipefail && xcodebuild test -workspace Kumi.xcworkspace -scheme KumiTests -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' | xcpretty
Expand Down
2 changes: 1 addition & 1 deletion Kumi.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "Kumi"
s.version = "0.0.4"
s.version = "0.0.5"
s.summary = "An iOS framework for easy theme integration to your application"

s.description = <<-DESC
Expand Down
25 changes: 19 additions & 6 deletions Kumi.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -436,18 +436,19 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Prolific Interactive";
TargetAttributes = {
8EC736CB1EB28CB60087846F = {
CreatedOnToolsVersion = 8.3.2;
DevelopmentTeam = 5ZZ7W4SB26;
LastSwiftMigration = 0830;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
8EC736D41EB28CB60087846F = {
CreatedOnToolsVersion = 8.3.2;
DevelopmentTeam = 5ZZ7W4SB26;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -650,15 +651,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = 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_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -704,15 +711,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = 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_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -759,7 +772,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -780,7 +793,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.Kumi;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -793,7 +806,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.KumiTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -806,7 +819,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.KumiTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
4 changes: 3 additions & 1 deletion Kumi.xcodeproj/xcshareddata/xcschemes/Kumi.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
Expand Down Expand Up @@ -56,6 +57,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 3 additions & 1 deletion Kumi.xcodeproj/xcshareddata/xcschemes/KumiTests.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -10,6 +10,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand All @@ -30,6 +31,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
24 changes: 17 additions & 7 deletions Kumi/Core/Utility/UIColor+Extensions.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// UIColor+Extensions.swift
// Gro
// Kumi
//
// Created by Htin Linn on 11/3/16.
// Copyright © 2016 Prolific Interactive. All rights reserved.
Expand All @@ -20,16 +20,26 @@ internal extension UIColor {
var rgbaValues = Array(repeating: CGFloat(0.0), count: 4)
var blendRgbaValues = Array(repeating: CGFloat(0.0), count: 4)

getRed(&rgbaValues[0], green: &rgbaValues[1], blue: &rgbaValues[2], alpha: &rgbaValues[3])
blendColor.getRed(&blendRgbaValues[0], green: &blendRgbaValues[1], blue: &blendRgbaValues[2], alpha: &blendRgbaValues[3])
var red = rgbaValues[0]
var green = rgbaValues[1]
var blue = rgbaValues[2]
var alpha = rgbaValues[3]

var blendRed = blendRgbaValues[0]
var blendGreen = blendRgbaValues[1]
var blendBlue = blendRgbaValues[2]
var blendAlpha = blendRgbaValues[3]

getRed(&red, green: &green, blue: &blue, alpha: &alpha)
blendColor.getRed(&blendRed, green: &blendGreen, blue: &blendBlue, alpha: &blendAlpha)

let invertWeight = 1 - weight

return UIColor(
red: (rgbaValues[0] * invertWeight + blendRgbaValues[0] * weight) / 1,
green: (rgbaValues[1] * invertWeight + blendRgbaValues[1] * weight) / 1,
blue: (rgbaValues[2] * invertWeight + blendRgbaValues[2] * weight) / 1,
alpha: (rgbaValues[3] * invertWeight + blendRgbaValues[3] * weight) / 1
red: (red * invertWeight + blendRed * weight) / 1,
green: (green * invertWeight + blendGreen * weight) / 1,
blue: (blue * invertWeight + blendBlue * weight) / 1,
alpha: (alpha * invertWeight + blendAlpha * weight) / 1
)
}

Expand Down
6 changes: 3 additions & 3 deletions KumiTests/Layer/LayerStyleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ class LayerStyleTests: XCTestCase {
XCTAssertEqual(layerStyle.masksToBounds, false)
XCTAssertEqual(layerStyle.isDoubleSided, true)
XCTAssertEqual(layerStyle.cornerRadius, 3.0)
XCTAssertEqual(layerStyle.backgroundColor, UIColor(colorLiteralRed: 1, green: 0, blue: 0, alpha: 1).cgColor)
XCTAssertEqual(layerStyle.backgroundColor, UIColor(red: 1, green: 0, blue: 0, alpha: 1).cgColor)
XCTAssertEqual(layerStyle.borderWidth, 0.0)
XCTAssertEqual(layerStyle.borderColor, UIColor(colorLiteralRed: 0, green: 1, blue: 0, alpha: 1).cgColor)
XCTAssertEqual(layerStyle.borderColor, UIColor(red: 0, green: 1, blue: 0, alpha: 1).cgColor)
XCTAssertEqual(layerStyle.shadowStyle.shadowOpacity, 1.0)
XCTAssertEqual(layerStyle.shadowStyle.shadowOffset.width, 0)
XCTAssertEqual(layerStyle.shadowStyle.shadowOffset.height, 7)
XCTAssertEqual(layerStyle.shadowStyle.shadowRadius, 14)
XCTAssertEqual(layerStyle.shadowColor, UIColor(colorLiteralRed: 1, green: 1, blue: 0, alpha: 1).cgColor)
XCTAssertEqual(layerStyle.shadowColor, UIColor(red: 1, green: 1, blue: 0, alpha: 1).cgColor)
XCTAssertNotNil(layerStyle.transform)
}

Expand Down
3 changes: 1 addition & 2 deletions KumiTests/Shadow/ShadowStyleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ class ShadowStyleTests: XCTestCase {
XCTAssertEqual(shadowStyle.shadowRadius, 14)
XCTAssertEqual(shadowStyle.shadowOffset.width, 0.0)
XCTAssertEqual(shadowStyle.shadowOffset.height, 7.0)
XCTAssertEqual(shadowStyle.shadowColor, UIColor(colorLiteralRed: 1, green: 0, blue: 0, alpha: 1).cgColor)

XCTAssertEqual(shadowStyle.shadowColor, UIColor(red: 1, green: 0, blue: 0, alpha: 1).cgColor)
}

}
12 changes: 6 additions & 6 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PODS:
- Kumi (0.0.2):
- Kumi (0.0.5):
- Marker
- Marker (0.7.0)
- SwiftLint (0.18.1)
- Marker (1.0.0)
- SwiftLint (0.23.1)

DEPENDENCIES:
- Kumi (from `./`)
Expand All @@ -14,9 +14,9 @@ EXTERNAL SOURCES:
:path: "./"

SPEC CHECKSUMS:
Kumi: 7e9a62026351e91434d49403ff80e54c7713f79b
Marker: 0d8b6b52915a92a0e366ebf359414a2a734504b0
SwiftLint: b467d08f5b25dc3b3cfed243d8e1b74b91714c67
Kumi: b7273af0ec1be5f2165a52763bd813aad06bdeef
Marker: f6b66b1e4507979bfdc110799793e74906010f4f
SwiftLint: 1b670ce79284c76520f84060e87d645078fd32fa

PODFILE CHECKSUM: 96841c94f1ec746841eb6d5603807c3ae30ccf9b

Expand Down
4 changes: 2 additions & 2 deletions Pods/Local Podspecs/Kumi.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d77d450

Please sign in to comment.