Skip to content

Commit

Permalink
Swift 5 Migration + SwiftUI (#696)
Browse files Browse the repository at this point in the history
* Run Swift 5 Migration Tool

* Inhibit warnings from CollectionKit as it is out of date

* ref #623 - add SwiftUI example

* ref #623 - revert target settings and make sure Example still works (in simulator)

* bundle install and pod install lockfiles

Co-authored-by: Nick Potts <github@nickpotts.com.au>
  • Loading branch information
JoeMatt and nick-potts authored Feb 8, 2021
1 parent 800b9d9 commit b1a73c4
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ node_modules
_book
xcodebuild.log
.swiftpm
/.bundle
59 changes: 28 additions & 31 deletions Hero.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -780,46 +780,40 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1120;
ORGANIZATIONNAME = "Luke Zhao";
TargetAttributes = {
2D1F7FBE1E49DCB5004D944B = {
CreatedOnToolsVersion = 8.2;
DevelopmentTeam = 4VSEW78TKT;
ProvisioningStyle = Automatic;
};
2D1F7FE11E49DD90004D944B = {
CreatedOnToolsVersion = 8.2;
DevelopmentTeam = 4VSEW78TKT;
ProvisioningStyle = Automatic;
};
A306D3B11E1C7A2E00B6C23A = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = 4VSEW78TKT;
LastSwiftMigration = 1000;
LastSwiftMigration = 1120;
ProvisioningStyle = Automatic;
};
A33E60A01DE761C90065CBD8 = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = 683UGRW72Z;
LastSwiftMigration = 1000;
LastSwiftMigration = 1120;
ProvisioningStyle = Automatic;
};
AF1E1B501E66822C00ECE039 = {
CreatedOnToolsVersion = 8.2;
DevelopmentTeam = 4VSEW78TKT;
LastSwiftMigration = 1000;
LastSwiftMigration = 1120;
ProvisioningStyle = Automatic;
TestTargetID = A33E60A01DE761C90065CBD8;
};
};
};
buildConfigurationList = A33E609C1DE761C90065CBD8 /* Build configuration list for PBXProject "Hero" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -1186,7 +1180,7 @@
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4VSEW78TKT;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down Expand Up @@ -1214,7 +1208,7 @@
CODE_SIGN_IDENTITY = "";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4VSEW78TKT;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -1241,7 +1235,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
DEVELOPMENT_TEAM = 4VSEW78TKT;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = TvOSExamples/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.6.0;
Expand All @@ -1261,7 +1255,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
DEVELOPMENT_TEAM = 4VSEW78TKT;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = TvOSExamples/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.6.0;
Expand All @@ -1282,9 +1276,10 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4VSEW78TKT;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -1297,7 +1292,7 @@
PRODUCT_NAME = Hero;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -1312,7 +1307,7 @@
CODE_SIGN_IDENTITY = "";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4VSEW78TKT;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -1324,7 +1319,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.Hero;
PRODUCT_NAME = Hero;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -1335,6 +1330,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand All @@ -1361,7 +1357,6 @@
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -1387,14 +1382,15 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
A33E60B21DE761C90065CBD8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand All @@ -1421,7 +1417,6 @@
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
Expand All @@ -1439,7 +1434,7 @@
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -1449,14 +1444,14 @@
baseConfigurationReference = 5CD4F09A588E81DA75C2BE38 /* Pods-HeroExamples.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 683UGRW72Z;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "$(SRCROOT)/Examples/Resources/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.6.0;
PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.HeroExamples;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -1466,14 +1461,14 @@
baseConfigurationReference = C377744CBFF1E24426E80F55 /* Pods-HeroExamples.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 683UGRW72Z;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "$(SRCROOT)/Examples/Resources/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.6.0;
PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.HeroExamples;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -1483,13 +1478,14 @@
baseConfigurationReference = C51A6465EC2CB38D82F28B93 /* Pods-HeroTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = 4VSEW78TKT;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.HeroTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HeroExamples.app/HeroExamples";
};
name = Debug;
Expand All @@ -1499,13 +1495,14 @@
baseConfigurationReference = 5CEC69C9A9A60129002FD931 /* Pods-HeroTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = 4VSEW78TKT;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.HeroTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HeroExamples.app/HeroExamples";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion Hero.xcodeproj/xcshareddata/xcschemes/Hero (tvOS).xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1120"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Hero.xcodeproj/xcshareddata/xcschemes/Hero.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1120"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
target 'HeroExamples' do
platform :ios, '9.0'
use_frameworks!
pod 'CollectionKit'
pod 'CollectionKit', :inhibit_warnings => true

target 'HeroTests' do
inherit! :search_paths
Expand Down
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ DEPENDENCIES:
- CollectionKit

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
https://cdn.cocoapods.org/:
- CollectionKit

SPEC CHECKSUMS:
CollectionKit: 5caa5341860d4c9b748ebfeaab97530b2d02c7c0

PODFILE CHECKSUM: efc6b025c2cee81dcc6fa480009618ed1af56837
PODFILE CHECKSUM: bfa4251748617deb38237ad241be4629254392c1

COCOAPODS: 1.8.4
2 changes: 1 addition & 1 deletion Sources/HeroContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ extension HeroContext {
let pairedView = pairedView(for: view),
let pairedSnapshot = snapshotViews[pairedView],
let siblingViews = pairedView.superview?.subviews,
let index = siblingViews.firstIndex(of: pairedView) {
let index = siblingViews.firstIndex(of: pairedView) {
let nextSiblings = siblingViews[index+1..<siblingViews.count]
containerView.addSubview(pairedSnapshot)
containerView.addSubview(snapshot)
Expand Down
4 changes: 2 additions & 2 deletions Sources/SwiftSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import CoreGraphics
import UIKit

extension CMTime {
static let zero = kCMTimeZero
static let zero = CMTime.zero
}

enum CAMediaTimingFillMode {
Expand Down Expand Up @@ -44,7 +44,7 @@ extension UIViewController {

extension RunLoop {
enum Mode {
static let common = RunLoopMode.commonModes
static let common = RunLoop.Mode.common
}
}

Expand Down

0 comments on commit b1a73c4

Please sign in to comment.