Skip to content

Commit 784770f

Browse files
committed
Migrate example project to Swift 4
1 parent 83b4e3b commit 784770f

File tree

6 files changed

+58
-47
lines changed

6 files changed

+58
-47
lines changed

Example/PagesDemo/.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.0

Example/PagesDemo/PagesDemo.xcodeproj/project.pbxproj

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@
128128
attributes = {
129129
LastSwiftMigration = 0700;
130130
LastSwiftUpdateCheck = 0700;
131-
LastUpgradeCheck = 0800;
131+
LastUpgradeCheck = 0900;
132132
ORGANIZATIONNAME = Hyper;
133133
TargetAttributes = {
134134
BDA158351AD7EEBD0011D55A = {
135135
CreatedOnToolsVersion = 6.3;
136-
LastSwiftMigration = 0800;
136+
LastSwiftMigration = 0900;
137137
};
138138
};
139139
};
@@ -174,13 +174,16 @@
174174
files = (
175175
);
176176
inputPaths = (
177+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
178+
"${PODS_ROOT}/Manifest.lock",
177179
);
178180
name = "[CP] Check Pods Manifest.lock";
179181
outputPaths = (
182+
"$(DERIVED_FILE_DIR)/Pods-PagesDemo-checkManifestLockResult.txt",
180183
);
181184
runOnlyForDeploymentPostprocessing = 0;
182185
shellPath = /bin/sh;
183-
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";
186+
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";
184187
showEnvVarsInLog = 0;
185188
};
186189
B554188A1267DC415D32994D /* [CP] Embed Pods Frameworks */ = {
@@ -189,9 +192,18 @@
189192
files = (
190193
);
191194
inputPaths = (
195+
"${SRCROOT}/Pods/Target Support Files/Pods-PagesDemo/Pods-PagesDemo-frameworks.sh",
196+
"${BUILT_PRODUCTS_DIR}/Cache/Cache.framework",
197+
"${BUILT_PRODUCTS_DIR}/Imaginary/Imaginary.framework",
198+
"${BUILT_PRODUCTS_DIR}/Pages/Pages.framework",
199+
"${BUILT_PRODUCTS_DIR}/SwiftHash/SwiftHash.framework",
192200
);
193201
name = "[CP] Embed Pods Frameworks";
194202
outputPaths = (
203+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cache.framework",
204+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Imaginary.framework",
205+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Pages.framework",
206+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftHash.framework",
195207
);
196208
runOnlyForDeploymentPostprocessing = 0;
197209
shellPath = /bin/sh;
@@ -237,14 +249,20 @@
237249
CLANG_CXX_LIBRARY = "libc++";
238250
CLANG_ENABLE_MODULES = YES;
239251
CLANG_ENABLE_OBJC_ARC = YES;
252+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
240253
CLANG_WARN_BOOL_CONVERSION = YES;
254+
CLANG_WARN_COMMA = YES;
241255
CLANG_WARN_CONSTANT_CONVERSION = YES;
242256
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
243257
CLANG_WARN_EMPTY_BODY = YES;
244258
CLANG_WARN_ENUM_CONVERSION = YES;
245259
CLANG_WARN_INFINITE_RECURSION = YES;
246260
CLANG_WARN_INT_CONVERSION = YES;
261+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
262+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
247263
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
264+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
265+
CLANG_WARN_STRICT_PROTOTYPES = YES;
248266
CLANG_WARN_SUSPICIOUS_MOVE = YES;
249267
CLANG_WARN_UNREACHABLE_CODE = YES;
250268
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -284,14 +302,20 @@
284302
CLANG_CXX_LIBRARY = "libc++";
285303
CLANG_ENABLE_MODULES = YES;
286304
CLANG_ENABLE_OBJC_ARC = YES;
305+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
287306
CLANG_WARN_BOOL_CONVERSION = YES;
307+
CLANG_WARN_COMMA = YES;
288308
CLANG_WARN_CONSTANT_CONVERSION = YES;
289309
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
290310
CLANG_WARN_EMPTY_BODY = YES;
291311
CLANG_WARN_ENUM_CONVERSION = YES;
292312
CLANG_WARN_INFINITE_RECURSION = YES;
293313
CLANG_WARN_INT_CONVERSION = YES;
314+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
315+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
294316
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
317+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
318+
CLANG_WARN_STRICT_PROTOTYPES = YES;
295319
CLANG_WARN_SUSPICIOUS_MOVE = YES;
296320
CLANG_WARN_UNREACHABLE_CODE = YES;
297321
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -334,7 +358,8 @@
334358
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.$(PRODUCT_NAME:rfc1034identifier)";
335359
PRODUCT_NAME = "$(TARGET_NAME)";
336360
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
337-
SWIFT_VERSION = 3.0;
361+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
362+
SWIFT_VERSION = 4.0;
338363
TARGETED_DEVICE_FAMILY = "1,2";
339364
};
340365
name = Debug;
@@ -352,7 +377,8 @@
352377
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
353378
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.$(PRODUCT_NAME:rfc1034identifier)";
354379
PRODUCT_NAME = "$(TARGET_NAME)";
355-
SWIFT_VERSION = 3.0;
380+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
381+
SWIFT_VERSION = 4.0;
356382
TARGETED_DEVICE_FAMILY = "1,2";
357383
};
358384
name = Release;

Example/PagesDemo/PagesDemo/AppDelegate.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import Imaginary
44

55
@UIApplicationMain
66
class AppDelegate: UIResponder, UIApplicationDelegate {
7-
87
var window: UIWindow?
98

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

@@ -26,17 +26,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2626
window = UIWindow(frame: UIScreen.main.bounds)
2727
window?.rootViewController = navigationController
2828
window?.makeKeyAndVisible()
29+
2930
return true
3031
}
3132

32-
func pagesControllerInCode() -> PagesController {
33-
33+
private func pagesControllerInCode() -> PagesController {
3434
var viewControllers: [UIViewController] = []
3535

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

4141
viewControllers.append(viewController)
4242
}
@@ -50,7 +50,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
5050
return pages
5151
}
5252

53-
func pagesControllerInStoryboard() -> PagesController {
53+
private func pagesControllerInStoryboard() -> PagesController {
5454
let storyboardIds = ["One","Two"]
5555
return PagesController(storyboardIds)
5656
}

Example/PagesDemo/Podfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use_frameworks!
22

33
platform :ios, '9.0'
44

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

Example/PagesDemo/Podfile.lock

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,25 @@
11
PODS:
2-
- Cache (1.5.1):
3-
- CryptoSwift
4-
- CryptoSwift (0.6.0)
5-
- Imaginary (0.1.0):
6-
- Cache
7-
- Pages (0.6.3)
2+
- Cache (4.0.1):
3+
- SwiftHash (~> 2.0.0)
4+
- Imaginary (3.0.0):
5+
- Cache (~> 4.0)
6+
- Pages (2.0.0)
7+
- SwiftHash (2.0.0)
88

99
DEPENDENCIES:
10-
- Cache (from `https://github.com/hyperoslo/Cache`, branch `swift-3`)
11-
- Imaginary (from `https://github.com/hyperoslo/Imaginary`, branch `swift-3`)
10+
- Imaginary (~> 3.0)
1211
- Pages (from `../../`)
1312

1413
EXTERNAL SOURCES:
15-
Cache:
16-
:branch: swift-3
17-
:git: https://github.com/hyperoslo/Cache
18-
Imaginary:
19-
:branch: swift-3
20-
:git: https://github.com/hyperoslo/Imaginary
2114
Pages:
22-
:path: "../../"
23-
24-
CHECKOUT OPTIONS:
25-
Cache:
26-
:commit: f4f1398fe02c762630a802b5e5ae9c334beafed9
27-
:git: https://github.com/hyperoslo/Cache
28-
Imaginary:
29-
:commit: b8780d8f5037ea49050bdca18087b9c92f53f502
30-
:git: https://github.com/hyperoslo/Imaginary
15+
:path: ../../
3116

3217
SPEC CHECKSUMS:
33-
Cache: 87b48b059429d3b53238533830c53941f8aa85f0
34-
CryptoSwift: 4a599b7241b8d3b857d6e2c28867d0bd5d1aae24
35-
Imaginary: 62a9ce1e6d7831ede429c8221a183f03ec2a90bc
36-
Pages: 71e80bc64040f1176297c327d080d80b7e74b38c
18+
Cache: 22f55fa3ab1b41e75799b479346b50b428fc5529
19+
Imaginary: 2765d293d425cbed3b07fa11642554cbaebe913d
20+
Pages: ed64dfa45562f9ce817f70af93361692975e7572
21+
SwiftHash: d2e09b13495447178cdfb8e46e54a5c46f15f5a9
3722

38-
PODFILE CHECKSUM: f6fbb74b8eb8023fc4977191667777541703f745
23+
PODFILE CHECKSUM: 704ea1ed834c6bde37b6188e9105c11f86c1ca77
3924

40-
COCOAPODS: 1.1.0.rc.2
25+
COCOAPODS: 1.3.1

Source/PagesController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ extension PagesController {
107107
}
108108
}
109109

110-
open func moveForward() {
110+
@objc open func moveForward() {
111111
goTo(currentIndex + 1)
112112
}
113113

114-
open func moveBack() {
114+
@objc open func moveBack() {
115115
goTo(currentIndex - 1)
116116
}
117117

0 commit comments

Comments
 (0)