Skip to content

Commit

Permalink
Upgraded to Swift 4. Left out some warnings as they are not critical.…
Browse files Browse the repository at this point in the history
… 5 test cases fail.
  • Loading branch information
IgorMuzyka committed Mar 23, 2018
1 parent ac64456 commit 3f2dec7
Show file tree
Hide file tree
Showing 122 changed files with 4,089 additions and 3,282 deletions.
40 changes: 32 additions & 8 deletions LeeGo.xcodeproj/project.pbxproj
Expand Up @@ -307,16 +307,16 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0920;
ORGANIZATIONNAME = "Victor Wang";
TargetAttributes = {
35F520001C7C73D40089FF41 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 0920;
};
35F5200A1C7C73D40089FF41 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 0920;
};
};
};
Expand Down Expand Up @@ -366,13 +366,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-LeeGoTests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
6B2D5E3E61978A4D366A4F11 /* [CP] Embed Pods Frameworks */ = {
Expand All @@ -381,9 +384,14 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-LeeGoTests/Pods-LeeGoTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework",
"${BUILT_PRODUCTS_DIR}/Quick/Quick.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Nimble.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Quick.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -463,14 +471,20 @@
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_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 @@ -514,14 +528,20 @@
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_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 @@ -566,7 +586,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.allblue-technology.LeeGo";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -587,7 +608,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -600,7 +622,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.allblue-technology.LeeGoTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -614,7 +637,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.allblue-technology.LeeGoTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
4 changes: 3 additions & 1 deletion LeeGo.xcodeproj/xcshareddata/xcschemes/LeeGo.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0920"
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
12 changes: 6 additions & 6 deletions LeeGoTests/AppearanceSpec.swift
Expand Up @@ -140,15 +140,15 @@ class AppearanceSpec: QuickSpec {
expect(label.shadowOffset) == CGSize(width: 1.0, height: 3.0)
expect(label.highlightedTextColor) == UIColor.clear

Appearance.attributedText([[NSFontAttributeName: UIFont(name: "Helvetica", size: 12)!]]).apply(to: label)
expect(label.attributedText) == NSAttributedString(string: "", attributes: [NSFontAttributeName: UIFont(name: "Helvetica", size: 12)!])
Appearance.attributedText([[NSAttributedStringKey.font.rawValue: UIFont(name: "Helvetica", size: 12)!]]).apply(to: label)
expect(label.attributedText) == NSAttributedString(string: "", attributes: [NSAttributedStringKey.font: UIFont(name: "Helvetica", size: 12)!])

// When
for appearance in appearances {
appearance.apply(to: label, useDefaultValue: true)
}

Appearance.attributedText([[NSFontAttributeName: UIFont(name: "Helvetica", size: 12)!]]).apply(to: label, useDefaultValue: true)
Appearance.attributedText([[NSAttributedStringKey.font.rawValue: UIFont(name: "Helvetica", size: 12)!]]).apply(to: label, useDefaultValue: true)

// Then
expect(label.isEnabled) == true
Expand All @@ -172,7 +172,7 @@ class AppearanceSpec: QuickSpec {
it("should apply appearance correctly to given UITextField") {
// Given
let image = UIImage(named: "twitter_favorite", in: Bundle(for: type(of: self)), compatibleWith: nil)!
let attributes:[Attributes] = [[NSFontAttributeName: UIFont(name: "Helvetica", size: 12)!]]
let attributes:[Attributes] = [[NSAttributedStringKey.font.rawValue: UIFont(name: "Helvetica", size: 12)!]]
let textField = UITextField()

let appearances: [Appearance] = [
Expand Down Expand Up @@ -215,7 +215,7 @@ class AppearanceSpec: QuickSpec {
XCTAssert(textField.clearButtonMode == .always)

Appearance.attributedText(attributes).apply(to: textField)
expect(textField.attributedText) == NSAttributedString(string: "", attributes: [NSFontAttributeName: UIFont(name: "Helvetica", size: 12)!])
expect(textField.attributedText) == NSAttributedString(string: "", attributes: [NSAttributedStringKey.font: UIFont(name: "Helvetica", size: 12)!])

// When
for appearance in appearances {
Expand Down Expand Up @@ -245,7 +245,7 @@ class AppearanceSpec: QuickSpec {

it("should apply appearance correctly to given UITextView") {
// Given
let attributes: [Attributes] = [[NSFontAttributeName: UIFont(name: "Helvetica", size: 12)!]]
let attributes: [Attributes] = [[NSAttributedStringKey.font.rawValue: UIFont(name: "Helvetica", size: 12)!]]
let textView = UITextView()

let appearances: [Appearance] = [
Expand Down
6 changes: 3 additions & 3 deletions LeeGoTests/ConvenienceSpec.swift
Expand Up @@ -55,9 +55,9 @@ class ConvenienceSpec: QuickSpec {
}

let attributes: [Attributes] = [
[NSFontAttributeName: UIFont(name: "Helvetica", size: 16)!, NSForegroundColorAttributeName: UIColor.red],
[kCustomAttributeDefaultText: "Test" as AnyObject, NSFontAttributeName: UIFont(name: "Avenir", size: 20)!, NSForegroundColorAttributeName: UIColor.darkText],
[NSFontAttributeName: UIFont(name: "Avenir", size: 16)!, NSForegroundColorAttributeName: UIColor.lightGray]
[NSAttributedStringKey.font.rawValue: UIFont(name: "Helvetica", size: 16)!, NSAttributedStringKey.foregroundColor.rawValue: UIColor.red],
[kCustomAttributeDefaultText: "Test" as AnyObject, NSAttributedStringKey.font.rawValue: UIFont(name: "Avenir", size: 20)!, NSAttributedStringKey.foregroundColor.rawValue: UIColor.darkText],
[NSAttributedStringKey.font.rawValue: UIFont(name: "Avenir", size: 16)!, NSAttributedStringKey.foregroundColor.rawValue: UIColor.lightGray]
]

it("should set attributed string correctly") {
Expand Down
12 changes: 6 additions & 6 deletions LeeGoTests/ConvertibleSpec.swift
Expand Up @@ -55,9 +55,9 @@ class ConvertibleSpec: QuickSpec {
.clearsOnInsertion(true),
.textContainerInset(UIEdgeInsets(top: 10, left: 10, bottom: 20, right: 20)),
.linkTextAttributes([
NSFontAttributeName: UIFont.systemFont(ofSize: 13),
NSForegroundColorAttributeName: UIColor.yellow,
NSBackgroundColorAttributeName: UIColor.blue
NSAttributedStringKey.font.rawValue: UIFont.systemFont(ofSize: 13),
NSAttributedStringKey.foregroundColor.rawValue: UIColor.yellow,
NSAttributedStringKey.backgroundColor.rawValue: UIColor.blue
]),
.lineFragmentPadding(12.0),
.minimumScaleFactor(0.3),
Expand All @@ -67,9 +67,9 @@ class ConvertibleSpec: QuickSpec {
.shadowOffset(CGSize(width: 10, height: 20)),
.highlightedTextColor(UIColor.clear),
.attributedText([
[NSFontAttributeName: UIFont(name: "Helvetica", size: 16)!, NSForegroundColorAttributeName: UIColor.red],
[kCustomAttributeDefaultText: "Test" as AnyObject, NSFontAttributeName: UIFont(name: "HelveticaNeue", size: 20)!, NSForegroundColorAttributeName: UIColor.darkText],
[NSFontAttributeName: UIFont(name: "HelveticaNeue", size: 16)!, NSForegroundColorAttributeName: UIColor.lightGray]
[NSAttributedStringKey.font.rawValue: UIFont(name: "Helvetica", size: 16)!, NSAttributedStringKey.foregroundColor.rawValue: UIColor.red],
[kCustomAttributeDefaultText: "Test" as AnyObject, NSAttributedStringKey.font.rawValue: UIFont(name: "HelveticaNeue", size: 20)!, NSAttributedStringKey.foregroundColor.rawValue: UIColor.darkText],
[NSAttributedStringKey.font: UIFont(name: "HelveticaNeue", size: 16)!, NSAttributedStringKey.foregroundColor: UIColor.lightGray]
]),
.text("Default Text"),
.borderStyle(.bezel),
Expand Down
6 changes: 3 additions & 3 deletions LeeGoTests/TestData.swift
Expand Up @@ -164,9 +164,9 @@ enum Style: String {
case .H3:
return [
.attributedText([
[NSFontAttributeName: UIFont(name: "Helvetica", size: 16)!, NSForegroundColorAttributeName: UIColor.red],
[kCustomAttributeDefaultText: "Test" as AnyObject, NSFontAttributeName: UIFont(name: "Avenir", size: 20)!, NSForegroundColorAttributeName: UIColor.darkText],
[NSFontAttributeName: UIFont(name: "Avenir", size: 16)!, NSForegroundColorAttributeName: UIColor.lightGray]
[NSAttributedStringKey.font.rawValue: UIFont(name: "Helvetica", size: 16)!, NSAttributedStringKey.foregroundColor.rawValue: UIColor.red],
[kCustomAttributeDefaultText: "Test" as AnyObject, NSAttributedStringKey.font.rawValue: UIFont(name: "Avenir", size: 20)!, NSAttributedStringKey.foregroundColor.rawValue: UIColor.darkText],
[NSAttributedStringKey.font.rawValue: UIFont(name: "Avenir", size: 16)!, NSAttributedStringKey.foregroundColor.rawValue: UIColor.lightGray]
]),
.numberOfLines(0),
.translatesAutoresizingMaskIntoConstraints(false)]
Expand Down
4 changes: 2 additions & 2 deletions Podfile
Expand Up @@ -2,7 +2,7 @@ source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

target 'LeeGoTests' do
pod 'Quick'
pod 'Nimble'
pod 'Quick', '~> 1.2.0'
pod 'Nimble', '~> 7.0.3'

end
16 changes: 8 additions & 8 deletions Podfile.lock
@@ -1,15 +1,15 @@
PODS:
- Nimble (5.1.1)
- Quick (0.10.0)
- Nimble (7.0.3)
- Quick (1.2.0)

DEPENDENCIES:
- Nimble
- Quick
- Nimble (~> 7.0.3)
- Quick (~> 1.2.0)

SPEC CHECKSUMS:
Nimble: 415e3aa3267e7bc2c96b05fa814ddea7bb686a29
Quick: 5d290df1c69d5ee2f0729956dcf0fd9a30447eaa
Nimble: 7f5a9c447a33002645a071bddafbfb24ea70e0ac
Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08

PODFILE CHECKSUM: 467db5b47f467b9102bb6e38e91d69c941df6bbb
PODFILE CHECKSUM: db15c173ae24133b755c44ce3caa51dc0e20cec7

COCOAPODS: 1.1.1
COCOAPODS: 1.4.0
16 changes: 8 additions & 8 deletions Pods/Manifest.lock

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

2 changes: 1 addition & 1 deletion Pods/Nimble/LICENSE.md → Pods/Nimble/LICENSE

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

0 comments on commit 3f2dec7

Please sign in to comment.