Skip to content

Commit

Permalink
Merge pull request #50 from hyperoslo/refactor/demo
Browse files Browse the repository at this point in the history
Migrate example project to Swift 4
  • Loading branch information
vadymmarkov authored Oct 2, 2017
2 parents 83b4e3b + 784770f commit c8550c6
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 47 deletions.
1 change: 1 addition & 0 deletions Example/PagesDemo/.swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0
36 changes: 31 additions & 5 deletions Example/PagesDemo/PagesDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = Hyper;
TargetAttributes = {
BDA158351AD7EEBD0011D55A = {
CreatedOnToolsVersion = 6.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
};
};
Expand Down Expand Up @@ -174,13 +174,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-PagesDemo-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;
};
B554188A1267DC415D32994D /* [CP] Embed Pods Frameworks */ = {
Expand All @@ -189,9 +192,18 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-PagesDemo/Pods-PagesDemo-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Cache/Cache.framework",
"${BUILT_PRODUCTS_DIR}/Imaginary/Imaginary.framework",
"${BUILT_PRODUCTS_DIR}/Pages/Pages.framework",
"${BUILT_PRODUCTS_DIR}/SwiftHash/SwiftHash.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cache.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Imaginary.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Pages.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftHash.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -237,14 +249,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 @@ -284,14 +302,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 @@ -334,7 +358,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -352,7 +377,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
12 changes: 6 additions & 6 deletions Example/PagesDemo/PagesDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import Imaginary

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let pages = pagesControllerInCode()
// let pages = pagesControllerInStoryboard()

Expand All @@ -26,17 +26,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = navigationController
window?.makeKeyAndVisible()

return true
}

func pagesControllerInCode() -> PagesController {

private func pagesControllerInCode() -> PagesController {
var viewControllers: [UIViewController] = []

for i in 0..<5 {
if let imageURL = URL(string: "https://unsplash.it/375/667/?image=\(i+10)") {
let viewController = ViewController()
viewController.imageView.setImage(imageURL)
viewController.imageView.setImage(url: imageURL)

viewControllers.append(viewController)
}
Expand All @@ -50,7 +50,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return pages
}

func pagesControllerInStoryboard() -> PagesController {
private func pagesControllerInStoryboard() -> PagesController {
let storyboardIds = ["One","Two"]
return PagesController(storyboardIds)
}
Expand Down
9 changes: 4 additions & 5 deletions Example/PagesDemo/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use_frameworks!

platform :ios, '9.0'

target 'PagesDemo' do
pod 'Pages', path: '../../'
pod 'Imaginary', git: 'https://github.com/hyperoslo/Imaginary', branch: 'swift-3'
pod 'Cache', git: 'https://github.com/hyperoslo/Cache', branch: 'swift-3'
end
pod 'Pages', path: '../../'
pod 'Imaginary', '~> 3.0'

target 'PagesDemo'
43 changes: 14 additions & 29 deletions Example/PagesDemo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
PODS:
- Cache (1.5.1):
- CryptoSwift
- CryptoSwift (0.6.0)
- Imaginary (0.1.0):
- Cache
- Pages (0.6.3)
- Cache (4.0.1):
- SwiftHash (~> 2.0.0)
- Imaginary (3.0.0):
- Cache (~> 4.0)
- Pages (2.0.0)
- SwiftHash (2.0.0)

DEPENDENCIES:
- Cache (from `https://github.com/hyperoslo/Cache`, branch `swift-3`)
- Imaginary (from `https://github.com/hyperoslo/Imaginary`, branch `swift-3`)
- Imaginary (~> 3.0)
- Pages (from `../../`)

EXTERNAL SOURCES:
Cache:
:branch: swift-3
:git: https://github.com/hyperoslo/Cache
Imaginary:
:branch: swift-3
:git: https://github.com/hyperoslo/Imaginary
Pages:
:path: "../../"

CHECKOUT OPTIONS:
Cache:
:commit: f4f1398fe02c762630a802b5e5ae9c334beafed9
:git: https://github.com/hyperoslo/Cache
Imaginary:
:commit: b8780d8f5037ea49050bdca18087b9c92f53f502
:git: https://github.com/hyperoslo/Imaginary
:path: ../../

SPEC CHECKSUMS:
Cache: 87b48b059429d3b53238533830c53941f8aa85f0
CryptoSwift: 4a599b7241b8d3b857d6e2c28867d0bd5d1aae24
Imaginary: 62a9ce1e6d7831ede429c8221a183f03ec2a90bc
Pages: 71e80bc64040f1176297c327d080d80b7e74b38c
Cache: 22f55fa3ab1b41e75799b479346b50b428fc5529
Imaginary: 2765d293d425cbed3b07fa11642554cbaebe913d
Pages: ed64dfa45562f9ce817f70af93361692975e7572
SwiftHash: d2e09b13495447178cdfb8e46e54a5c46f15f5a9

PODFILE CHECKSUM: f6fbb74b8eb8023fc4977191667777541703f745
PODFILE CHECKSUM: 704ea1ed834c6bde37b6188e9105c11f86c1ca77

COCOAPODS: 1.1.0.rc.2
COCOAPODS: 1.3.1
4 changes: 2 additions & 2 deletions Source/PagesController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ extension PagesController {
}
}

open func moveForward() {
@objc open func moveForward() {
goTo(currentIndex + 1)
}

open func moveBack() {
@objc open func moveBack() {
goTo(currentIndex - 1)
}

Expand Down

0 comments on commit c8550c6

Please sign in to comment.