Skip to content

Commit

Permalink
Merge pull request #394 from xmartlabs/swift4
Browse files Browse the repository at this point in the history
Added support for swift 4
  • Loading branch information
pera committed Oct 5, 2017
2 parents 6aede68 + 342bdec commit b67f31b
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: objective-c
osx_image: xcode8.3
osx_image: xcode9
env:
- DESTINATION="OS=10.3,name=iPhone 6s" SCHEME="XLPagerTabStrip" SDK=iphonesimulator10.3
- DESTINATION="OS=11.0,name=iPhone 7" SCHEME="XLPagerTabStrip" SDK=iphonesimulator
before_install:
- brew update
#- brew outdated carthage || brew upgrade carthage
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Change Log
All notable changes to XLPagerTabStrip will be documented in this file.

### [8.0.0](https://github.com/xmartlabs/XLPagerTabStrip/releases/tag/8.0.0)

* Xcode 9 support. (Swift 4)
* Bug fixes and stability improvements.

### [7.0.0](https://github.com/xmartlabs/XLPagerTabStrip/releases/tag/7.0.0)

* Bug fixes and stability improvements.

### [6.0.0](https://github.com/xmartlabs/XLPagerTabStrip/releases/tag/5.0.0)
### [6.0.0](https://github.com/xmartlabs/XLPagerTabStrip/releases/tag/6.0.0)

* Swift 3 support
* **Breaking change**: Swiftified names of functions (you can see more details about it [here](https://github.com/xmartlabs/XLPagerTabStrip/Migration.md))
Expand Down
30 changes: 23 additions & 7 deletions Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,15 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
TargetAttributes = {
28F828CB1C4B714D00330CF4 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
28F828DF1C4B714D00330CF4 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
TestTargetID = 28F828CB1C4B714D00330CF4;
};
};
Expand Down Expand Up @@ -438,14 +438,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -484,14 +490,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -528,7 +540,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -543,7 +556,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -556,7 +570,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 +585,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
4 changes: 2 additions & 2 deletions Example/Example/ButtonBarExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ class ButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
return [child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8]
}

var childViewControllers = [child_1, child_2, child_3, child_4, child_6, child_7, child_8]
var childViewControllers = [child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8]

for index in childViewControllers.indices {
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
4 changes: 2 additions & 2 deletions Example/Example/NavButtonBarExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ class NavButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
return [child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8]
}

var childViewControllers = [child_1, child_2, child_3, child_4, child_6, child_7, child_8]
var childViewControllers = [child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8]

for index in childViewControllers.indices {
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
4 changes: 2 additions & 2 deletions Example/Example/TwitterExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ class TwitterExampleViewController: TwitterPagerTabStripViewController {
return [child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8]
}

var childViewControllers = [child_1, child_2, child_3, child_4, child_6, child_7, child_8]
var childViewControllers = [child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8]

for index in childViewControllers.indices {
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<p align="left">
<a href="https://travis-ci.org/xmartlabs/XLPagerTabStrip"><img src="https://travis-ci.org/xmartlabs/XLPagerTabStrip.svg?branch=master" alt="Build status" /></a>
<img src="https://img.shields.io/badge/platform-iOS-blue.svg?style=flat" alt="Platform iOS" />
<a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/swift3-compatible-4BC51D.svg?style=flat" alt="Swift 3 compatible" /></a>
<a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/swift4-compatible-4BC51D.svg?style=flat" alt="Swift 3 compatible" /></a>
<a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible" /></a>
<a href="https://cocoapods.org/pods/XLActionController"><img src="https://img.shields.io/badge/pod-7.0.0-blue.svg" alt="CocoaPods compatible" /></a>
<a href="https://cocoapods.org/pods/XLActionController"><img src="https://img.shields.io/badge/pod-8.0.0-blue.svg" alt="CocoaPods compatible" /></a>
<a href="https://raw.githubusercontent.com/xmartlabs/XLPagerTabStrip/master/LICENSE"><img src="http://img.shields.io/badge/license-MIT-blue.svg?style=flat" alt="License: MIT" />
</a>
<!-- <a href="https://codebeat.co/projects/github-com-xmartlabs-xlpagertabstrip"><img alt="codebeat badge" src="https://codebeat.co/badges/f32c9ad3-0aa1-4b40-a632-9421211bd39e" /></a> -->
Expand Down Expand Up @@ -305,7 +305,7 @@ Follow these 3 steps to run Example project: Clone XLPagerTabStrip repository, o
To install XLPagerTabStrip, simply add the following line to your Podfile:

```ruby
pod 'XLPagerTabStrip', '~> 7.0'
pod 'XLPagerTabStrip', '~> 8.0'
```

### Carthage
Expand All @@ -315,7 +315,7 @@ pod 'XLPagerTabStrip', '~> 7.0'
To install XLPagerTabStrip, simply add the following line to your Cartfile:

```ogdl
github "xmartlabs/XLPagerTabStrip" ~> 7.0
github "xmartlabs/XLPagerTabStrip" ~> 8.0
```

## FAQ
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
1 change: 0 additions & 1 deletion Sources/FXPageControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@


#pragma GCC diagnostic ignored "-Wgnu"
#pragma GCC diagnostic ignored "-Wreceiver-is-weak"
#pragma GCC diagnostic ignored "-Warc-repeated-use-of-weak"
#pragma GCC diagnostic ignored "-Wdirect-ivar-access"

Expand Down
6 changes: 3 additions & 3 deletions Sources/PagerTabStripBehaviour.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public enum PagerTabStripBehaviour {

public var isProgressiveIndicator: Bool {
switch self {
case .common(_):
case .common:
return false
case .progressive(_, _):
case .progressive:
return true
}
}

public var isElasticIndicatorLimit: Bool {
switch self {
case .common(_):
case .common:
return false
case .progressive(_, let elasticIndicatorLimit):
return elasticIndicatorLimit
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
2 changes: 1 addition & 1 deletion XLPagerTabStrip.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "XLPagerTabStrip"
s.version = "7.0.0"
s.version = "8.0.0"
s.summary = "Android PagerTabStrip for iOS and much more."
s.homepage = "https://github.com/xmartlabs/XLPagerTabStrip"
s.license = { type: 'MIT', file: 'LICENSE' }
Expand Down
22 changes: 18 additions & 4 deletions XLPagerTabStrip.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0810;
LastUpgradeCheck = 0900;
TargetAttributes = {
28F8287C1C494B2C00330CF4 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
28F828861C494B2C00330CF4 = {
CreatedOnToolsVersion = 7.2;
Expand Down Expand Up @@ -342,14 +342,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -393,14 +399,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -445,7 +457,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.XLPagerTabStrip;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -465,7 +478,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.XLPagerTabStrip;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0810"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down

0 comments on commit b67f31b

Please sign in to comment.