Skip to content

Commit

Permalink
Migrate to Swift 5.0 (#146)
Browse files Browse the repository at this point in the history
- Update Static.xcodeproj to recommended settings

- Migrate the deprecated English localization language to the new one named en
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;

- Migrate to Swift 5.0

- Replace hashValue computed property with hash(into:) method in Row.swift and Section.swift

- Update UITableView.Style extension computed property defaultSectionExtremityHeight by adding @unknown default handling to switch statement

- Update .travis.yml file to use Xcode 10.2
  • Loading branch information
keitaito committed Apr 4, 2019
2 parents 7ceb922 + 26b17ee commit 769106f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: swift
osx_image: xcode10
osx_image: xcode10.2
xcode_project: Static.xcodeproj

script: xcodebuild -scheme "$TRAVIS_XCODE_SCHEME" -sdk "$TRAVIS_XCODE_SDK" -destination "$DESTINATION" test
Expand All @@ -9,4 +9,4 @@ matrix:
- xcode_scheme: Static-iOS
xcode_sdk: iphonesimulator
env:
- DESTINATION="OS=10.1,name=iPhone 7 Plus"
- DESTINATION="OS=12.2,name=iPhone X"
24 changes: 13 additions & 11 deletions Static.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -274,26 +274,26 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 1000;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = Venmo;
TargetAttributes = {
21826AA91B3F51A100AA9641 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
};
21826AB31B3F51A100AA9641 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
};
36748D4E1B5034EC0046F207 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
};
};
};
buildConfigurationList = 21826AA41B3F51A100AA9641 /* Build configuration list for PBXProject "Static" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -409,6 +409,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;
Expand Down Expand Up @@ -468,6 +469,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;
Expand Down Expand Up @@ -533,7 +535,7 @@
PRODUCT_NAME = Static;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -555,7 +557,7 @@
PRODUCT_NAME = Static;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -566,7 +568,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.venmo.static.tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -578,7 +580,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.venmo.static.tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -591,7 +593,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.venmo.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -605,7 +607,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.venmo.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Static.xcodeproj/xcshareddata/xcschemes/Example.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1020"
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 = "1000"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
1 change: 1 addition & 0 deletions Static/DataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ extension UITableView.Style {
switch self {
case .plain: return 0
case .grouped: return UITableView.automaticDimension
@unknown default: return UITableView.automaticDimension
}
}
}
4 changes: 2 additions & 2 deletions Static/Row.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ public struct Row: Hashable, Equatable {
return cellClass.description()
}

public var hashValue: Int {
return uuid.hashValue
public func hash(into hasher: inout Hasher) {
hasher.combine(uuid)
}


Expand Down
4 changes: 2 additions & 2 deletions Static/Section.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public struct Section: Hashable, Equatable {
/// Section index title
public var indexTitle: String?

public var hashValue: Int {
return uuid.hashValue
public func hash(into hasher: inout Hasher) {
hasher.combine(uuid)
}


Expand Down

0 comments on commit 769106f

Please sign in to comment.