Skip to content

Commit

Permalink
Merge pull request #67 from kazuhiro4949/feature/swift4.2
Browse files Browse the repository at this point in the history
Supporting swift4.2 Xcode10
  • Loading branch information
kazuhiro4949 authored Sep 20, 2018
2 parents 6b2e2ec + bc151e5 commit 2b42198
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions PagingKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -426,7 +426,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion PagingKit/Array+NSLayoutConstraint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import Foundation

extension Array where Element == NSLayoutAttribute {
extension Array where Element == NSLayoutConstraint.Attribute {
/// anchor same attributes between fromView and toView
/// convert to "view1.attr1 = view2.attr2 * multiplier + constant"
/// - Parameters:
Expand Down
6 changes: 3 additions & 3 deletions PagingKit/PagingContentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public class PagingContentViewController: UIViewController {

fileprivate func removeAll() {
scrollView.subviews.forEach { $0.removeFromSuperview() }
childViewControllers.forEach { $0.removeFromParentViewController() }
children.forEach { $0.removeFromParent() }
}

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

if case nil = cachedViewControllers[page], let dataSource = dataSource {
let vc = dataSource.contentViewController(viewController: self, viewControllerAt: page)
addChildViewController(vc)
addChild(vc)
vc.view.frame = scrollView.bounds
vc.view.frame.origin.x = scrollView.bounds.width * CGFloat(page)
scrollView.addSubview(vc.view)
vc.didMove(toParentViewController: self)
vc.didMove(toParent: self)
cachedViewControllers[page] = vc
}
}
Expand Down
2 changes: 1 addition & 1 deletion PagingKit/PagingKitProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ extension PagingKitProxy where Base == UIView.Type {
UIView.perform(
.delete,
on: [],
options: UIViewAnimationOptions(rawValue: 0),
options: UIView.AnimationOptions(rawValue: 0),
animations: animations,
completion: completion
)
Expand Down
2 changes: 1 addition & 1 deletion PagingKit/PagingMenuView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public class PagingMenuView: UIScrollView {
focusView.selectedIndex = index
visibleCells.selectCell(with: index)

UIView.perform(.delete, on: [], options: UIViewAnimationOptions(rawValue: 0), animations: { [weak self] in
UIView.perform(.delete, on: [], options: UIView.AnimationOptions(rawValue: 0), animations: { [weak self] in
self?.contentOffset = offset
self?.focusView.frame = itemFrame
self?.focusView.layoutIfNeeded()
Expand Down
2 changes: 1 addition & 1 deletion PagingKit/TitleLabelMenuViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class TitleLabelMenuViewCell: PagingMenuViewCell {


/// syntax sugar of NSLayoutConstraint for titleLabel (Because this library supports iOS8, it cannnot use NSLayoutAnchor.)
private func anchorLabel(from fromItem: Any, to toItem: Any, attribute: NSLayoutAttribute) -> NSLayoutConstraint {
private func anchorLabel(from fromItem: Any, to toItem: Any, attribute: NSLayoutConstraint.Attribute) -> NSLayoutConstraint {
return NSLayoutConstraint(
item: fromItem,
attribute: attribute,
Expand Down
12 changes: 6 additions & 6 deletions iOS Sample/iOS Sample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "kazuhiro.hayashi.iOS-Sample";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -771,7 +771,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "kazuhiro.hayashi.iOS-Sample";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -786,7 +786,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "kazuhiro.hayashi.iOS-SampleTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOS Sample.app/iOS Sample";
};
name = Debug;
Expand All @@ -802,7 +802,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "kazuhiro.hayashi.iOS-SampleTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOS Sample.app/iOS Sample";
};
name = Release;
Expand All @@ -817,7 +817,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "kazuhiro.hayashi.iOS-SampleUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TEST_TARGET_NAME = "iOS Sample";
};
name = Debug;
Expand All @@ -832,7 +832,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "kazuhiro.hayashi.iOS-SampleUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TEST_TARGET_NAME = "iOS Sample";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion iOS Sample/iOS Sample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
2 changes: 1 addition & 1 deletion iOS Sample/iOS Sample/ArbitraryNumberViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ extension ArbitraryNumberViewController: PagingMenuViewControllerDataSource {
return UIScreen.main.bounds.width / CGFloat(dataSource.count)
} else {
ArbitraryNumberViewController.sizingCell.titleLabel.text = dataSource[index].menu
var referenceSize = UILayoutFittingCompressedSize
var referenceSize = UIView.layoutFittingCompressedSize
referenceSize.height = viewController.view.bounds.height
let size = ArbitraryNumberViewController.sizingCell.systemLayoutSizeFitting(referenceSize)
return size.width
Expand Down
4 changes: 2 additions & 2 deletions iOS Sample/iOS Sample/DynamicSizeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class DynamicSizeViewController: UIViewController {
let height = size.height * CGFloat(arc4random_uniform(100)) / 100

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

func menuViewController(viewController: PagingMenuViewController, widthForItemAt index: Int) -> CGFloat {
DynamicSizeViewController.sizingCell.titleLabel.text = dataSource[index].menu
var referenceSize = UILayoutFittingCompressedSize
var referenceSize = UIView.layoutFittingCompressedSize
referenceSize.height = viewController.view.bounds.height
let size = DynamicSizeViewController.sizingCell.systemLayoutSizeFitting(referenceSize)
return size.width
Expand Down
2 changes: 1 addition & 1 deletion iOS Sample/iOS Sample/FullscreenViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ extension FullscreenViewController: PagingMenuViewControllerDataSource {

func menuViewController(viewController: PagingMenuViewController, widthForItemAt index: Int) -> CGFloat {
TagMenuCell.sizingCell.titieLabel.text = dataSource[index].menu.title
var referenceSize = UILayoutFittingCompressedSize
var referenceSize = UIView.layoutFittingCompressedSize
referenceSize.height = viewController.view.bounds.height
let size = TagMenuCell.sizingCell.systemLayoutSizeFitting(referenceSize)
return size.width
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class InitializingWithoutStoryboardViewController: UIViewController {
menuViewController.view.translatesAutoresizingMaskIntoConstraints = false

// add content vc on this vc.
addChildViewController(menuViewController)
addChild(menuViewController)
view.addSubview(menuViewController.view)
menuViewController.didMove(toParentViewController: self)
menuViewController.didMove(toParent: self)

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

// add content vc on this vc.
addChildViewController(contentViewController)
addChild(contentViewController)
view.addSubview(contentViewController.view)
contentViewController.didMove(toParentViewController: self)
contentViewController.didMove(toParent: self)

// set autolayout
if #available(iOS 11.0, *) {
Expand Down
2 changes: 1 addition & 1 deletion iOS Sample/iOS Sample/MenuReloadableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ extension MenuReloadableViewController: PagingMenuViewControllerDataSource {

func menuViewController(viewController: PagingMenuViewController, widthForItemAt index: Int) -> CGFloat {
MenuReloadableViewController.sizingCell.titleLabel.text = dataSource[index].menu
var referenceSize = UILayoutFittingCompressedSize
var referenceSize = UIView.layoutFittingCompressedSize
referenceSize.height = viewController.view.bounds.height
let size = MenuReloadableViewController.sizingCell.systemLayoutSizeFitting(referenceSize)
return size.width
Expand Down
2 changes: 1 addition & 1 deletion iOS Sample/iOS Sample/OverlayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ extension OverlayViewController: PagingMenuViewControllerDataSource {

func menuViewController(viewController: PagingMenuViewController, widthForItemAt index: Int) -> CGFloat {
OverlayMenuCell.sizingCell.textLabel.text = dataSource[index].menu
var referenceSize = UILayoutFittingCompressedSize
var referenceSize = UIView.layoutFittingCompressedSize
referenceSize.height = viewController.view.bounds.height
let size = OverlayMenuCell.sizingCell.systemLayoutSizeFitting(referenceSize, withHorizontalFittingPriority: UILayoutPriority.defaultLow, verticalFittingPriority: UILayoutPriority.defaultHigh)
return size.width
Expand Down
2 changes: 1 addition & 1 deletion iOS Sample/iOS Sample/TagMenuCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TagMenuCell: PagingMenuViewCell {
UIView.perform(
.delete,
on: [],
options: UIViewAnimationOptions(rawValue: 0),
options: UIView.AnimationOptions(rawValue: 0),
animations: { [weak self] in
self?.setNeedsLayout()
self?.layoutIfNeeded()
Expand Down
2 changes: 1 addition & 1 deletion iOS Sample/iOS Sample/TagViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extension TagViewController: PagingMenuViewControllerDataSource {

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

0 comments on commit 2b42198

Please sign in to comment.