Skip to content

Commit 2b42198

Browse files
authored
Merge pull request #67 from kazuhiro4949/feature/swift4.2
Supporting swift4.2 Xcode10
2 parents 6b2e2ec + bc151e5 commit 2b42198

16 files changed

+28
-28
lines changed

PagingKit.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@
402402
SKIP_INSTALL = YES;
403403
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
404404
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
405-
SWIFT_VERSION = 4.0;
405+
SWIFT_VERSION = 4.2;
406406
};
407407
name = Debug;
408408
};
@@ -426,7 +426,7 @@
426426
PROVISIONING_PROFILE_SPECIFIER = "";
427427
SKIP_INSTALL = YES;
428428
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
429-
SWIFT_VERSION = 4.0;
429+
SWIFT_VERSION = 4.2;
430430
};
431431
name = Release;
432432
};

PagingKit/Array+NSLayoutConstraint.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import Foundation
2626

27-
extension Array where Element == NSLayoutAttribute {
27+
extension Array where Element == NSLayoutConstraint.Attribute {
2828
/// anchor same attributes between fromView and toView
2929
/// convert to "view1.attr1 = view2.attr2 * multiplier + constant"
3030
/// - Parameters:

PagingKit/PagingContentViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public class PagingContentViewController: UIViewController {
289289

290290
fileprivate func removeAll() {
291291
scrollView.subviews.forEach { $0.removeFromSuperview() }
292-
childViewControllers.forEach { $0.removeFromParentViewController() }
292+
children.forEach { $0.removeFromParent() }
293293
}
294294

295295
fileprivate func initialLoad(with page: Int) {
@@ -306,11 +306,11 @@ public class PagingContentViewController: UIViewController {
306306

307307
if case nil = cachedViewControllers[page], let dataSource = dataSource {
308308
let vc = dataSource.contentViewController(viewController: self, viewControllerAt: page)
309-
addChildViewController(vc)
309+
addChild(vc)
310310
vc.view.frame = scrollView.bounds
311311
vc.view.frame.origin.x = scrollView.bounds.width * CGFloat(page)
312312
scrollView.addSubview(vc.view)
313-
vc.didMove(toParentViewController: self)
313+
vc.didMove(toParent: self)
314314
cachedViewControllers[page] = vc
315315
}
316316
}

PagingKit/PagingKitProxy.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ extension PagingKitProxy where Base == UIView.Type {
8888
UIView.perform(
8989
.delete,
9090
on: [],
91-
options: UIViewAnimationOptions(rawValue: 0),
91+
options: UIView.AnimationOptions(rawValue: 0),
9292
animations: animations,
9393
completion: completion
9494
)

PagingKit/PagingMenuView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public class PagingMenuView: UIScrollView {
358358
focusView.selectedIndex = index
359359
visibleCells.selectCell(with: index)
360360

361-
UIView.perform(.delete, on: [], options: UIViewAnimationOptions(rawValue: 0), animations: { [weak self] in
361+
UIView.perform(.delete, on: [], options: UIView.AnimationOptions(rawValue: 0), animations: { [weak self] in
362362
self?.contentOffset = offset
363363
self?.focusView.frame = itemFrame
364364
self?.focusView.layoutIfNeeded()

PagingKit/TitleLabelMenuViewCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public class TitleLabelMenuViewCell: PagingMenuViewCell {
8989

9090

9191
/// syntax sugar of NSLayoutConstraint for titleLabel (Because this library supports iOS8, it cannnot use NSLayoutAnchor.)
92-
private func anchorLabel(from fromItem: Any, to toItem: Any, attribute: NSLayoutAttribute) -> NSLayoutConstraint {
92+
private func anchorLabel(from fromItem: Any, to toItem: Any, attribute: NSLayoutConstraint.Attribute) -> NSLayoutConstraint {
9393
return NSLayoutConstraint(
9494
item: fromItem,
9595
attribute: attribute,

iOS Sample/iOS Sample.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@
756756
PRODUCT_BUNDLE_IDENTIFIER = "kazuhiro.hayashi.iOS-Sample";
757757
PRODUCT_NAME = "$(TARGET_NAME)";
758758
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
759-
SWIFT_VERSION = 4.0;
759+
SWIFT_VERSION = 4.2;
760760
};
761761
name = Debug;
762762
};
@@ -771,7 +771,7 @@
771771
PRODUCT_BUNDLE_IDENTIFIER = "kazuhiro.hayashi.iOS-Sample";
772772
PRODUCT_NAME = "$(TARGET_NAME)";
773773
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
774-
SWIFT_VERSION = 4.0;
774+
SWIFT_VERSION = 4.2;
775775
};
776776
name = Release;
777777
};
@@ -786,7 +786,7 @@
786786
PRODUCT_BUNDLE_IDENTIFIER = "kazuhiro.hayashi.iOS-SampleTests";
787787
PRODUCT_NAME = "$(TARGET_NAME)";
788788
SWIFT_SWIFT3_OBJC_INFERENCE = On;
789-
SWIFT_VERSION = 4.0;
789+
SWIFT_VERSION = 4.2;
790790
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOS Sample.app/iOS Sample";
791791
};
792792
name = Debug;
@@ -802,7 +802,7 @@
802802
PRODUCT_BUNDLE_IDENTIFIER = "kazuhiro.hayashi.iOS-SampleTests";
803803
PRODUCT_NAME = "$(TARGET_NAME)";
804804
SWIFT_SWIFT3_OBJC_INFERENCE = On;
805-
SWIFT_VERSION = 4.0;
805+
SWIFT_VERSION = 4.2;
806806
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOS Sample.app/iOS Sample";
807807
};
808808
name = Release;
@@ -817,7 +817,7 @@
817817
PRODUCT_BUNDLE_IDENTIFIER = "kazuhiro.hayashi.iOS-SampleUITests";
818818
PRODUCT_NAME = "$(TARGET_NAME)";
819819
SWIFT_SWIFT3_OBJC_INFERENCE = On;
820-
SWIFT_VERSION = 4.0;
820+
SWIFT_VERSION = 4.2;
821821
TEST_TARGET_NAME = "iOS Sample";
822822
};
823823
name = Debug;
@@ -832,7 +832,7 @@
832832
PRODUCT_BUNDLE_IDENTIFIER = "kazuhiro.hayashi.iOS-SampleUITests";
833833
PRODUCT_NAME = "$(TARGET_NAME)";
834834
SWIFT_SWIFT3_OBJC_INFERENCE = On;
835-
SWIFT_VERSION = 4.0;
835+
SWIFT_VERSION = 4.2;
836836
TEST_TARGET_NAME = "iOS Sample";
837837
};
838838
name = Release;

iOS Sample/iOS Sample/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3030
var window: UIWindow?
3131

3232

33-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
33+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
3434
// Override point for customization after application launch.
3535
return true
3636
}

iOS Sample/iOS Sample/ArbitraryNumberViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ extension ArbitraryNumberViewController: PagingMenuViewControllerDataSource {
8080
return UIScreen.main.bounds.width / CGFloat(dataSource.count)
8181
} else {
8282
ArbitraryNumberViewController.sizingCell.titleLabel.text = dataSource[index].menu
83-
var referenceSize = UILayoutFittingCompressedSize
83+
var referenceSize = UIView.layoutFittingCompressedSize
8484
referenceSize.height = viewController.view.bounds.height
8585
let size = ArbitraryNumberViewController.sizingCell.systemLayoutSizeFitting(referenceSize)
8686
return size.width

iOS Sample/iOS Sample/DynamicSizeViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class DynamicSizeViewController: UIViewController {
7070
let height = size.height * CGFloat(arc4random_uniform(100)) / 100
7171

7272
let updateSize = height <= 108 ? .zero : CGSize(width: width, height: height)
73-
UIView.perform(.delete, on: [], options: UIViewAnimationOptions(rawValue: 0), animations: { [weak self] in
73+
UIView.perform(.delete, on: [], options: UIView.AnimationOptions(rawValue: 0), animations: { [weak self] in
7474
self?.view.frame.size = updateSize
7575
self?.view.setNeedsLayout()
7676
self?.view.layoutIfNeeded()
@@ -88,7 +88,7 @@ extension DynamicSizeViewController: PagingMenuViewControllerDataSource {
8888

8989
func menuViewController(viewController: PagingMenuViewController, widthForItemAt index: Int) -> CGFloat {
9090
DynamicSizeViewController.sizingCell.titleLabel.text = dataSource[index].menu
91-
var referenceSize = UILayoutFittingCompressedSize
91+
var referenceSize = UIView.layoutFittingCompressedSize
9292
referenceSize.height = viewController.view.bounds.height
9393
let size = DynamicSizeViewController.sizingCell.systemLayoutSizeFitting(referenceSize)
9494
return size.width

iOS Sample/iOS Sample/FullscreenViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ extension FullscreenViewController: PagingMenuViewControllerDataSource {
7272

7373
func menuViewController(viewController: PagingMenuViewController, widthForItemAt index: Int) -> CGFloat {
7474
TagMenuCell.sizingCell.titieLabel.text = dataSource[index].menu.title
75-
var referenceSize = UILayoutFittingCompressedSize
75+
var referenceSize = UIView.layoutFittingCompressedSize
7676
referenceSize.height = viewController.view.bounds.height
7777
let size = TagMenuCell.sizingCell.systemLayoutSizeFitting(referenceSize)
7878
return size.width

iOS Sample/iOS Sample/InitializingWithoutStoryboardViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class InitializingWithoutStoryboardViewController: UIViewController {
3939
menuViewController.view.translatesAutoresizingMaskIntoConstraints = false
4040

4141
// add content vc on this vc.
42-
addChildViewController(menuViewController)
42+
addChild(menuViewController)
4343
view.addSubview(menuViewController.view)
44-
menuViewController.didMove(toParentViewController: self)
44+
menuViewController.didMove(toParent: self)
4545

4646
// set autolayout
4747
if #available(iOS 11.0, *) {
@@ -69,9 +69,9 @@ class InitializingWithoutStoryboardViewController: UIViewController {
6969
contentViewController.view.translatesAutoresizingMaskIntoConstraints = false
7070

7171
// add content vc on this vc.
72-
addChildViewController(contentViewController)
72+
addChild(contentViewController)
7373
view.addSubview(contentViewController.view)
74-
contentViewController.didMove(toParentViewController: self)
74+
contentViewController.didMove(toParent: self)
7575

7676
// set autolayout
7777
if #available(iOS 11.0, *) {

iOS Sample/iOS Sample/MenuReloadableViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ extension MenuReloadableViewController: PagingMenuViewControllerDataSource {
9696

9797
func menuViewController(viewController: PagingMenuViewController, widthForItemAt index: Int) -> CGFloat {
9898
MenuReloadableViewController.sizingCell.titleLabel.text = dataSource[index].menu
99-
var referenceSize = UILayoutFittingCompressedSize
99+
var referenceSize = UIView.layoutFittingCompressedSize
100100
referenceSize.height = viewController.view.bounds.height
101101
let size = MenuReloadableViewController.sizingCell.systemLayoutSizeFitting(referenceSize)
102102
return size.width

iOS Sample/iOS Sample/OverlayViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ extension OverlayViewController: PagingMenuViewControllerDataSource {
7979

8080
func menuViewController(viewController: PagingMenuViewController, widthForItemAt index: Int) -> CGFloat {
8181
OverlayMenuCell.sizingCell.textLabel.text = dataSource[index].menu
82-
var referenceSize = UILayoutFittingCompressedSize
82+
var referenceSize = UIView.layoutFittingCompressedSize
8383
referenceSize.height = viewController.view.bounds.height
8484
let size = OverlayMenuCell.sizingCell.systemLayoutSizeFitting(referenceSize, withHorizontalFittingPriority: UILayoutPriority.defaultLow, verticalFittingPriority: UILayoutPriority.defaultHigh)
8585
return size.width

iOS Sample/iOS Sample/TagMenuCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class TagMenuCell: PagingMenuViewCell {
3838
UIView.perform(
3939
.delete,
4040
on: [],
41-
options: UIViewAnimationOptions(rawValue: 0),
41+
options: UIView.AnimationOptions(rawValue: 0),
4242
animations: { [weak self] in
4343
self?.setNeedsLayout()
4444
self?.layoutIfNeeded()

iOS Sample/iOS Sample/TagViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ extension TagViewController: PagingMenuViewControllerDataSource {
102102

103103
func menuViewController(viewController: PagingMenuViewController, widthForItemAt index: Int) -> CGFloat {
104104
TagMenuCell.sizingCell.titieLabel.text = dataSource[index].menu.title
105-
var referenceSize = UILayoutFittingCompressedSize
105+
var referenceSize = UIView.layoutFittingCompressedSize
106106
referenceSize.height = viewController.view.bounds.height
107107
let size = TagMenuCell.sizingCell.systemLayoutSizeFitting(referenceSize)
108108
return size.width

0 commit comments

Comments
 (0)