Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
added support for swift 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico Ojeda committed Jun 7, 2017
1 parent 6aede68 commit df0840a
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 18 deletions.
16 changes: 10 additions & 6 deletions Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,11 @@
TargetAttributes = {
28F828CB1C4B714D00330CF4 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
28F828DF1C4B714D00330CF4 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
TestTargetID = 28F828CB1C4B714D00330CF4;
};
};
Expand Down Expand Up @@ -528,7 +528,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -543,7 +544,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -556,7 +558,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.ExampleUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TEST_TARGET_NAME = Example;
USES_XCTRUNNER = YES;
};
Expand All @@ -570,7 +573,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.ExampleUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TEST_TARGET_NAME = Example;
USES_XCTRUNNER = YES;
};
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/BarExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class BarExampleViewController: BarPagerTabStripViewController {
let nElements = childViewControllers.count - index
let n = (Int(arc4random()) % nElements) + index
if n != index {
swap(&childViewControllers[index], &childViewControllers[n])
childViewControllers.swapAt(index, n)
}
}
let nItems = 1 + (arc4random() % 4)
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/ButtonBarExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
let nElements = childViewControllers.count - index
let n = (Int(arc4random()) % nElements) + index
if n != index {
swap(&childViewControllers[index], &childViewControllers[n])
childViewControllers.swapAt(index, n)
}
}
let nItems = 1 + (arc4random() % 8)
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/NavButtonBarExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class NavButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
let nElements = childViewControllers.count - index
let n = (Int(arc4random()) % nElements) + index
if n != index {
swap(&childViewControllers[index], &childViewControllers[n])
childViewControllers.swapAt(index, n)
}
}
let nItems = 1 + (arc4random() % 8)
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/SegmentedExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class SegmentedExampleViewController: SegmentedPagerTabStripViewController {
let nElements = count - index
let n = (Int(arc4random()) % nElements) + index
if n != index {
swap(&childViewControllers[index], &childViewControllers[n])
childViewControllers.swapAt(index, n)
}
}
let nItems = 1 + (arc4random() % 4)
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/TwitterExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class TwitterExampleViewController: TwitterPagerTabStripViewController {
let nElements = childViewControllers.count - index
let n = (Int(arc4random()) % nElements) + index
if n != index {
swap(&childViewControllers[index], &childViewControllers[n])
childViewControllers.swapAt(index, n)
}
}
let nItems = 1 + (arc4random() % 8)
Expand Down
2 changes: 1 addition & 1 deletion Sources/BaseButtonBarPagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ open class BaseButtonBarPagerTabStripViewController<ButtonBarCellType: UICollect

// MARK: - UICollectionViewDelegateFlowLayut

open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize {
@objc open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize {
guard let cellWidthValue = cachedCellWidths?[indexPath.row] else {
fatalError("cachedCellWidths for \(indexPath.row) must not be nil")
}
Expand Down
5 changes: 3 additions & 2 deletions Sources/ButtonBarPagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa

if reload {
let indexPathsToReload = cells.enumerated()
.flatMap { index, cell in
.flatMap { (arg) -> IndexPath? in
let (index, cell) = arg
return cell == nil ? indexPaths[index] : nil
}
.flatMap { (indexPath: IndexPath) -> IndexPath? in
Expand All @@ -267,7 +268,7 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa

// MARK: - UICollectionViewDelegateFlowLayut

open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize {
@objc open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize {
guard let cellWidthValue = cachedCellWidths?[indexPath.row] else {
fatalError("cachedCellWidths for \(indexPath.row) must not be nil")
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/SegmentedPagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ open class SegmentedPagerTabStripViewController: PagerTabStripViewController, Pa
segmentedControl.selectedSegmentIndex = currentIndex
}

func segmentedControlChanged(_ sender: UISegmentedControl) {
@objc func segmentedControlChanged(_ sender: UISegmentedControl) {
let index = sender.selectedSegmentIndex
updateIndicator(for: self, fromIndex: currentIndex, toIndex: index)
shouldUpdateSegmentedControl = false
Expand Down
8 changes: 5 additions & 3 deletions XLPagerTabStrip.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
TargetAttributes = {
28F8287C1C494B2C00330CF4 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
28F828861C494B2C00330CF4 = {
CreatedOnToolsVersion = 7.2;
Expand Down Expand Up @@ -445,7 +445,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.XLPagerTabStrip;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -465,7 +466,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.XLPagerTabStrip;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down

0 comments on commit df0840a

Please sign in to comment.