Skip to content

Commit f15957d

Browse files
author
Denis Sancov
committed
Swift 5 support
1 parent be74eed commit f15957d

File tree

4 files changed

+37
-16
lines changed

4 files changed

+37
-16
lines changed

EMPageViewController.xcodeproj/project.pbxproj

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
isa = PBXProject;
147147
attributes = {
148148
LastSwiftUpdateCheck = 0720;
149-
LastUpgradeCheck = 0800;
149+
LastUpgradeCheck = 1020;
150150
ORGANIZATIONNAME = "Erik Malyak";
151151
TargetAttributes = {
152152
8079226F1C651DE90067DAD2 = {
@@ -160,10 +160,11 @@
160160
};
161161
buildConfigurationList = 8079226A1C651DE90067DAD2 /* Build configuration list for PBXProject "EMPageViewController" */;
162162
compatibilityVersion = "Xcode 3.2";
163-
developmentRegion = English;
163+
developmentRegion = en;
164164
hasScannedForEncodings = 0;
165165
knownRegions = (
166166
en,
167+
Base,
167168
);
168169
mainGroup = 807922661C651DE90067DAD2;
169170
productRefGroup = 807922711C651DE90067DAD2 /* Products */;
@@ -229,14 +230,22 @@
229230
CLANG_CXX_LIBRARY = "libc++";
230231
CLANG_ENABLE_MODULES = YES;
231232
CLANG_ENABLE_OBJC_ARC = YES;
233+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
232234
CLANG_WARN_BOOL_CONVERSION = YES;
235+
CLANG_WARN_COMMA = YES;
233236
CLANG_WARN_CONSTANT_CONVERSION = YES;
237+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
234238
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
235239
CLANG_WARN_EMPTY_BODY = YES;
236240
CLANG_WARN_ENUM_CONVERSION = YES;
237241
CLANG_WARN_INFINITE_RECURSION = YES;
238242
CLANG_WARN_INT_CONVERSION = YES;
243+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
244+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
245+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
239246
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
247+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
248+
CLANG_WARN_STRICT_PROTOTYPES = YES;
240249
CLANG_WARN_SUSPICIOUS_MOVE = YES;
241250
CLANG_WARN_UNREACHABLE_CODE = YES;
242251
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -279,14 +288,22 @@
279288
CLANG_CXX_LIBRARY = "libc++";
280289
CLANG_ENABLE_MODULES = YES;
281290
CLANG_ENABLE_OBJC_ARC = YES;
291+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
282292
CLANG_WARN_BOOL_CONVERSION = YES;
293+
CLANG_WARN_COMMA = YES;
283294
CLANG_WARN_CONSTANT_CONVERSION = YES;
295+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
284296
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
285297
CLANG_WARN_EMPTY_BODY = YES;
286298
CLANG_WARN_ENUM_CONVERSION = YES;
287299
CLANG_WARN_INFINITE_RECURSION = YES;
288300
CLANG_WARN_INT_CONVERSION = YES;
301+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
302+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
303+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
289304
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
305+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
306+
CLANG_WARN_STRICT_PROTOTYPES = YES;
290307
CLANG_WARN_SUSPICIOUS_MOVE = YES;
291308
CLANG_WARN_UNREACHABLE_CODE = YES;
292309
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -331,7 +348,7 @@
331348
PRODUCT_NAME = "$(TARGET_NAME)";
332349
SKIP_INSTALL = YES;
333350
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
334-
SWIFT_VERSION = 3.0;
351+
SWIFT_VERSION = 5.0;
335352
};
336353
name = Debug;
337354
};
@@ -350,7 +367,7 @@
350367
PRODUCT_BUNDLE_IDENTIFIER = com.erikmalyak.EMPageViewController;
351368
PRODUCT_NAME = "$(TARGET_NAME)";
352369
SKIP_INSTALL = YES;
353-
SWIFT_VERSION = 3.0;
370+
SWIFT_VERSION = 5.0;
354371
};
355372
name = Release;
356373
};

EMPageViewController.xcodeproj/xcshareddata/xcschemes/EMPageViewController.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0820"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

EMPageViewController/EMPageViewController.swift

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -425,14 +425,14 @@ open class EMPageViewController: UIViewController, UIScrollViewDelegate {
425425

426426
private func addChildIfNeeded(_ viewController: UIViewController) {
427427
self.scrollView.addSubview(viewController.view)
428-
self.addChildViewController(viewController)
429-
viewController.didMove(toParentViewController: self)
428+
self.addChild(viewController)
429+
viewController.didMove(toParent: self)
430430
}
431431

432432
private func removeChildIfNeeded(_ viewController: UIViewController?) {
433433
viewController?.view.removeFromSuperview()
434-
viewController?.didMove(toParentViewController: nil)
435-
viewController?.removeFromParentViewController()
434+
viewController?.didMove(toParent: nil)
435+
viewController?.removeFromParent()
436436
}
437437

438438
private func layoutViews() {
@@ -454,9 +454,13 @@ open class EMPageViewController: UIViewController, UIScrollViewDelegate {
454454
self.adjustingContentOffset = true
455455
self.scrollView.contentOffset = CGPoint(x: self.isOrientationHorizontal ? viewWidth : 0, y: self.isOrientationHorizontal ? 0 : viewHeight)
456456
if self.isOrientationHorizontal {
457-
self.scrollView.contentInset = UIEdgeInsetsMake(0, beforeInset, 0, afterInset)
457+
self.scrollView.contentInset = UIEdgeInsets(
458+
top: 0, left: beforeInset, bottom: 0, right: afterInset
459+
)
458460
} else {
459-
self.scrollView.contentInset = UIEdgeInsetsMake(beforeInset, 0, afterInset, 0)
461+
self.scrollView.contentInset = UIEdgeInsets(
462+
top: beforeInset, left: 0, bottom: afterInset, right: 0
463+
)
460464
}
461465
self.adjustingContentOffset = false
462466

@@ -571,14 +575,14 @@ open class EMPageViewController: UIViewController, UIScrollViewDelegate {
571575

572576
if self.isOrientationHorizontal {
573577
if (self.beforeViewController != nil && self.afterViewController != nil) || // It isn't at the beginning or end of the page collection
574-
(self.afterViewController != nil && self.beforeViewController == nil && scrollView.contentOffset.x > fabs(scrollView.contentInset.left)) || // If it's at the beginning of the collection, the decelleration can't be triggered by scrolling away from, than torwards the inset
575-
(self.beforeViewController != nil && self.afterViewController == nil && scrollView.contentOffset.x < fabs(scrollView.contentInset.right)) { // Same as the last condition, but at the end of the collection
578+
(self.afterViewController != nil && self.beforeViewController == nil && scrollView.contentOffset.x > abs(scrollView.contentInset.left)) || // If it's at the beginning of the collection, the decelleration can't be triggered by scrolling away from, than torwards the inset
579+
(self.beforeViewController != nil && self.afterViewController == nil && scrollView.contentOffset.x < abs(scrollView.contentInset.right)) { // Same as the last condition, but at the end of the collection
576580
scrollView.setContentOffset(CGPoint(x: self.view.bounds.width, y: 0), animated: true)
577581
}
578582
} else {
579583
if (self.beforeViewController != nil && self.afterViewController != nil) || // It isn't at the beginning or end of the page collection
580-
(self.afterViewController != nil && self.beforeViewController == nil && scrollView.contentOffset.y > fabs(scrollView.contentInset.top)) || // If it's at the beginning of the collection, the decelleration can't be triggered by scrolling away from, than torwards the inset
581-
(self.beforeViewController != nil && self.afterViewController == nil && scrollView.contentOffset.y < fabs(scrollView.contentInset.bottom)) { // Same as the last condition, but at the end of the collection
584+
(self.afterViewController != nil && self.beforeViewController == nil && scrollView.contentOffset.y > abs(scrollView.contentInset.top)) || // If it's at the beginning of the collection, the decelleration can't be triggered by scrolling away from, than torwards the inset
585+
(self.beforeViewController != nil && self.afterViewController == nil && scrollView.contentOffset.y < abs(scrollView.contentInset.bottom)) { // Same as the last condition, but at the end of the collection
582586
scrollView.setContentOffset(CGPoint(x: 0, y: self.view.bounds.height), animated: true)
583587
}
584588
}

EMPageViewController/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>3.0</string>
18+
<string>3.1</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

0 commit comments

Comments
 (0)