Skip to content

Commit

Permalink
Converting the Sample App to use Swift 3 (#37)
Browse files Browse the repository at this point in the history
Also, removing Sample app pods from git ignore and checking it in.
  • Loading branch information
plivesey authored Sep 19, 2016
1 parent ca4f587 commit b58a6ae
Show file tree
Hide file tree
Showing 28 changed files with 2,906 additions and 9 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ xcuserdata
docs/_build/**
docs/sphinx_rtd_theme/**


SampleApp/Pods/
64 changes: 64 additions & 0 deletions SampleApp/ConsistencyManagerDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
61DB68841CBC5A1A00BD1F65 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61DB687A1CBC5A1A00BD1F65 /* MainViewController.swift */; };
61DB68851CBC5A1A00BD1F65 /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61DB687B1CBC5A1A00BD1F65 /* MainViewController.xib */; };
61DB68871CBC5C5200BD1F65 /* PerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61DB68861CBC5C5200BD1F65 /* PerformanceTests.swift */; };
6C45BC922373C4407D88F511 /* Pods_ConsistencyManagerDemoTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6422FA64723520B3B58D3F12 /* Pods_ConsistencyManagerDemoTests.framework */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -63,10 +64,13 @@
61DB687A1CBC5A1A00BD1F65 /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
61DB687B1CBC5A1A00BD1F65 /* MainViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainViewController.xib; sourceTree = "<group>"; };
61DB68861CBC5C5200BD1F65 /* PerformanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PerformanceTests.swift; sourceTree = "<group>"; };
6422FA64723520B3B58D3F12 /* Pods_ConsistencyManagerDemoTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ConsistencyManagerDemoTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6E210B67B1E1FD1686485F50 /* Pods-ConsistencyManagerDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConsistencyManagerDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ConsistencyManagerDemo/Pods-ConsistencyManagerDemo.debug.xcconfig"; sourceTree = "<group>"; };
734D065F5910B4D21566E7D5 /* Pods-ConsistencyManagerDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConsistencyManagerDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-ConsistencyManagerDemo/Pods-ConsistencyManagerDemo.release.xcconfig"; sourceTree = "<group>"; };
759A782C6CADF4AC944DF279 /* Pods-ConsistencyManagerDemoTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConsistencyManagerDemoTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ConsistencyManagerDemoTests/Pods-ConsistencyManagerDemoTests.debug.xcconfig"; sourceTree = "<group>"; };
B8EC009E94A4E8CC989B8CC3 /* Pods_ConsistencyManagerDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ConsistencyManagerDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C344DB998673B6A206DFC7F6 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; };
FF19B31ACE93FA0F4E627B2C /* Pods-ConsistencyManagerDemoTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConsistencyManagerDemoTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ConsistencyManagerDemoTests/Pods-ConsistencyManagerDemoTests.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -82,6 +86,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6C45BC922373C4407D88F511 /* Pods_ConsistencyManagerDemoTests.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -93,6 +98,8 @@
children = (
6E210B67B1E1FD1686485F50 /* Pods-ConsistencyManagerDemo.debug.xcconfig */,
734D065F5910B4D21566E7D5 /* Pods-ConsistencyManagerDemo.release.xcconfig */,
759A782C6CADF4AC944DF279 /* Pods-ConsistencyManagerDemoTests.debug.xcconfig */,
FF19B31ACE93FA0F4E627B2C /* Pods-ConsistencyManagerDemoTests.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
Expand Down Expand Up @@ -197,6 +204,7 @@
children = (
C344DB998673B6A206DFC7F6 /* Pods.framework */,
B8EC009E94A4E8CC989B8CC3 /* Pods_ConsistencyManagerDemo.framework */,
6422FA64723520B3B58D3F12 /* Pods_ConsistencyManagerDemoTests.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -228,9 +236,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 61DB686B1CBC596F00BD1F65 /* Build configuration list for PBXNativeTarget "ConsistencyManagerDemoTests" */;
buildPhases = (
88DF663DD2D8E929007A60CE /* [CP] Check Pods Manifest.lock */,
61DB685B1CBC596F00BD1F65 /* Sources */,
61DB685C1CBC596F00BD1F65 /* Frameworks */,
61DB685D1CBC596F00BD1F65 /* Resources */,
D1F2E7B3AED4AD7F0212ED88 /* [CP] Embed Pods Frameworks */,
E89AD40B1913B6D56B8EC358 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -254,9 +265,11 @@
TargetAttributes = {
61DB684A1CBC596F00BD1F65 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0800;
};
61DB685E1CBC596F00BD1F65 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0800;
TestTargetID = 61DB684A1CBC596F00BD1F65;
};
};
Expand Down Expand Up @@ -333,6 +346,36 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ConsistencyManagerDemo/Pods-ConsistencyManagerDemo-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
88DF663DD2D8E929007A60CE /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
D1F2E7B3AED4AD7F0212ED88 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ConsistencyManagerDemoTests/Pods-ConsistencyManagerDemoTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
DE066A886970E3002EA1B200 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -348,6 +391,21 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
E89AD40B1913B6D56B8EC358 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ConsistencyManagerDemoTests/Pods-ConsistencyManagerDemoTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -491,6 +549,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = LinkedIn.ConsistencyManagerDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
Expand All @@ -504,30 +563,35 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = LinkedIn.ConsistencyManagerDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
};
61DB686C1CBC596F00BD1F65 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 759A782C6CADF4AC944DF279 /* Pods-ConsistencyManagerDemoTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
INFOPLIST_FILE = ConsistencyManagerDemoTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = LinkedIn.ConsistencyManagerDemoTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ConsistencyManagerDemo.app/ConsistencyManagerDemo";
};
name = Debug;
};
61DB686D1CBC596F00BD1F65 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FF19B31ACE93FA0F4E627B2C /* Pods-ConsistencyManagerDemoTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
INFOPLIST_FILE = ConsistencyManagerDemoTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = LinkedIn.ConsistencyManagerDemoTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ConsistencyManagerDemo.app/ConsistencyManagerDemo";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion SampleApp/ConsistencyManagerDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow? = UIWindow(frame: UIScreen.main.bounds)

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

let mainViewController = MainViewController(nibName: "MainViewController", bundle: nil)
window?.rootViewController = UINavigationController(rootViewController: mainViewController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import ConsistencyManager
class Network {

// This class fakes a network response
class func fetchUpdates(_ callback: (StreamModel) -> ()) {
class func fetchUpdates(_ callback: @escaping (StreamModel) -> ()) {
DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async {
let updates = Array(0..<20).map() { index in
UpdateModel(id: "\(index)", liked: index % 2 == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class MainViewController: UIViewController, UITableViewDataSource, UITableViewDe
// MARK: - Cell Actions

func buttonWasTappedOnCell(_ cell: TableViewCell) {
let index = (tableView.indexPath(for: cell) as NSIndexPath?)?.row
let index = (tableView.indexPath(for: cell) as IndexPath?)?.row
if let index = index {
let update = stream?.updates[index]
if let update = update {
Expand Down
12 changes: 12 additions & 0 deletions SampleApp/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@ end
target 'ConsistencyManagerDemoTests' do
pod 'ConsistencyManager', :path => '..'
end

# This is necessary to convert the target to swift 3
# This isn't detected automatically by cocoapods or supported in the podspec
# We can remove this once Cocoapods has a better solution
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end

8 changes: 4 additions & 4 deletions SampleApp/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PODS:
- ConsistencyManager (2.0.0)
- ConsistencyManager (2.0.2)

DEPENDENCIES:
- ConsistencyManager (from `..`)

EXTERNAL SOURCES:
ConsistencyManager:
:path: ".."
:path: ..

SPEC CHECKSUMS:
ConsistencyManager: 4a1f6f20628befc25ed3393444c7c18ae64149a4
ConsistencyManager: 16842eca9215db1f83aa413dbe1bbc7bcf49f7ff

PODFILE CHECKSUM: b21bbf55226ba480e94d5cf731df9621484fed45
PODFILE CHECKSUM: 059c638441a9686bc44a9c763919db7de9ffddf9

COCOAPODS: 1.0.1
28 changes: 28 additions & 0 deletions SampleApp/Pods/Local Podspecs/ConsistencyManager.podspec.json

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

16 changes: 16 additions & 0 deletions SampleApp/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 b58a6ae

Please sign in to comment.