Skip to content

Commit a98448b

Browse files
author
pera
authored
Merge branch 'master' into feature/indicator-custom-info
2 parents 77da46e + 248b2cb commit a98448b

39 files changed

+596
-552
lines changed

.swiftlint.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
disabled_rules: # rule identifiers to exclude from running
2+
# - colon
3+
# - comma
4+
# - control_statement
5+
- line_length
6+
- function_body_length
7+
- identifier_name
8+
- type_name
9+
- large_tuple
10+
opt_in_rules: # some rules are only opt-in
11+
- empty_count
12+
# Find all the available rules by running:
13+
# swiftlint rules
14+
excluded: # paths to ignore during linting. Takes precedence over `included`.
15+
- Carthage
16+
- Pods
17+
- Source/ExcludedFolder
18+
- Source/ExcludedFile.swift
19+
20+
# configurable rules can be customized from this configuration file
21+
# binary rules can set their severity level
22+
force_cast: warning # implicitly
23+
force_try:
24+
severity: warning # explicitly
25+
# rules that have both warning and error levels, can set just the warning level
26+
# implicitly
27+
line_length: 200
28+
# they can set both implicitly with an array
29+
type_body_length:
30+
- 300 # warning
31+
- 400 # error
32+
# or they can set both explicitly
33+
file_length:
34+
warning: 500
35+
error: 1200
36+
# naming rules can set warnings/errors for min_length and max_length
37+
# additionally they can set excluded names
38+
type_name:
39+
min_length: 4 # only warning
40+
max_length: # warning and error
41+
warning: 40
42+
error: 50
43+
excluded: iPhone # excluded via string
44+
identifier_name:
45+
min_length: # only min_length
46+
error: 4 # only error
47+
excluded: # excluded via string array
48+
- id
49+
- URL
50+
- GlobalAPIKey
51+
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji)

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: objective-c
2-
osx_image: xcode8
2+
osx_image: xcode9
33
env:
4-
- DESTINATION="OS=10.0,name=iPhone 6s" SCHEME="XLPagerTabStrip" SDK=iphonesimulator10.0
4+
- DESTINATION="OS=11.0,name=iPhone 7" SCHEME="XLPagerTabStrip" SDK=iphonesimulator
55
before_install:
66
- brew update
77
#- brew outdated carthage || brew upgrade carthage

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# Change Log
22
All notable changes to XLPagerTabStrip will be documented in this file.
33

4+
### [8.0.0](https://github.com/xmartlabs/XLPagerTabStrip/releases/tag/8.0.0)
5+
6+
* Xcode 9 support. (Swift 4)
7+
* Bug fixes and stability improvements.
8+
49
### [7.0.0](https://github.com/xmartlabs/XLPagerTabStrip/releases/tag/7.0.0)
510

611
* Bug fixes and stability improvements.
712

8-
### [6.0.0](https://github.com/xmartlabs/XLPagerTabStrip/releases/tag/5.0.0)
13+
### [6.0.0](https://github.com/xmartlabs/XLPagerTabStrip/releases/tag/6.0.0)
914

1015
* Swift 3 support
1116
* **Breaking change**: Swiftified names of functions (you can see more details about it [here](https://github.com/xmartlabs/XLPagerTabStrip/Migration.md))

Example.xcodeproj/project.pbxproj

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@
295295
isa = PBXProject;
296296
attributes = {
297297
LastSwiftUpdateCheck = 0720;
298-
LastUpgradeCheck = 0800;
298+
LastUpgradeCheck = 0900;
299299
TargetAttributes = {
300300
28F828CB1C4B714D00330CF4 = {
301301
CreatedOnToolsVersion = 7.2;
302-
LastSwiftMigration = 0800;
302+
LastSwiftMigration = 0900;
303303
};
304304
28F828DF1C4B714D00330CF4 = {
305305
CreatedOnToolsVersion = 7.2;
306-
LastSwiftMigration = 0800;
306+
LastSwiftMigration = 0900;
307307
TestTargetID = 28F828CB1C4B714D00330CF4;
308308
};
309309
};
@@ -438,14 +438,20 @@
438438
CLANG_CXX_LIBRARY = "libc++";
439439
CLANG_ENABLE_MODULES = YES;
440440
CLANG_ENABLE_OBJC_ARC = YES;
441+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
441442
CLANG_WARN_BOOL_CONVERSION = YES;
443+
CLANG_WARN_COMMA = YES;
442444
CLANG_WARN_CONSTANT_CONVERSION = YES;
443445
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
444446
CLANG_WARN_EMPTY_BODY = YES;
445447
CLANG_WARN_ENUM_CONVERSION = YES;
446448
CLANG_WARN_INFINITE_RECURSION = YES;
447449
CLANG_WARN_INT_CONVERSION = YES;
450+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
451+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
448452
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
453+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
454+
CLANG_WARN_STRICT_PROTOTYPES = YES;
449455
CLANG_WARN_SUSPICIOUS_MOVE = YES;
450456
CLANG_WARN_UNREACHABLE_CODE = YES;
451457
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -484,14 +490,20 @@
484490
CLANG_CXX_LIBRARY = "libc++";
485491
CLANG_ENABLE_MODULES = YES;
486492
CLANG_ENABLE_OBJC_ARC = YES;
493+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
487494
CLANG_WARN_BOOL_CONVERSION = YES;
495+
CLANG_WARN_COMMA = YES;
488496
CLANG_WARN_CONSTANT_CONVERSION = YES;
489497
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
490498
CLANG_WARN_EMPTY_BODY = YES;
491499
CLANG_WARN_ENUM_CONVERSION = YES;
492500
CLANG_WARN_INFINITE_RECURSION = YES;
493501
CLANG_WARN_INT_CONVERSION = YES;
502+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
503+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
494504
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
505+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
506+
CLANG_WARN_STRICT_PROTOTYPES = YES;
495507
CLANG_WARN_SUSPICIOUS_MOVE = YES;
496508
CLANG_WARN_UNREACHABLE_CODE = YES;
497509
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -528,7 +540,8 @@
528540
PRODUCT_NAME = "$(TARGET_NAME)";
529541
SWIFT_OBJC_BRIDGING_HEADER = "";
530542
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
531-
SWIFT_VERSION = 3.0;
543+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
544+
SWIFT_VERSION = 4.0;
532545
};
533546
name = Debug;
534547
};
@@ -543,7 +556,8 @@
543556
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.Example;
544557
PRODUCT_NAME = "$(TARGET_NAME)";
545558
SWIFT_OBJC_BRIDGING_HEADER = "";
546-
SWIFT_VERSION = 3.0;
559+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
560+
SWIFT_VERSION = 4.0;
547561
};
548562
name = Release;
549563
};
@@ -556,7 +570,8 @@
556570
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.ExampleUITests;
557571
PRODUCT_NAME = "$(TARGET_NAME)";
558572
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
559-
SWIFT_VERSION = 3.0;
573+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
574+
SWIFT_VERSION = 4.0;
560575
TEST_TARGET_NAME = Example;
561576
USES_XCTRUNNER = YES;
562577
};
@@ -570,7 +585,8 @@
570585
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
571586
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.ExampleUITests;
572587
PRODUCT_NAME = "$(TARGET_NAME)";
573-
SWIFT_VERSION = 3.0;
588+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
589+
SWIFT_VERSION = 4.0;
574590
TEST_TARGET_NAME = Example;
575591
USES_XCTRUNNER = YES;
576592
};

Example/Example/AppDelegate.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1212

1313
var window: UIWindow?
1414

15-
1615
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
1716
// Override point for customization after application launch.
18-
17+
1918
UITabBar.appearance().tintColor = UIColor.init(red: 0.027, green: 0.725, blue: 0.608, alpha: 1)
2019
UIApplication.shared.statusBarStyle = .lightContent
21-
22-
let _ = YoutubeExampleViewController(nibName: nil, bundle: nil)
23-
20+
21+
_ = YoutubeExampleViewController(nibName: nil, bundle: nil)
22+
2423
return true
2524
}
2625

@@ -46,6 +45,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4645
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
4746
}
4847

49-
5048
}
51-

Example/Example/BarExampleViewController.swift

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,51 +27,50 @@ import XLPagerTabStrip
2727

2828
class BarExampleViewController: BarPagerTabStripViewController {
2929
var isReload = false
30-
30+
3131
required init?(coder aDecoder: NSCoder) {
3232
super.init(coder: aDecoder)
3333
}
34-
34+
3535
override func viewDidLoad() {
36-
36+
3737
// set up style before super view did load is executed
3838
settings.style.selectedBarBackgroundColor = .orange
3939
// -
40-
40+
4141
super.viewDidLoad()
4242
}
43-
43+
4444
// MARK: - PagerTabStripDataSource
45-
45+
4646
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
47-
47+
4848
let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "Table View")
4949
let child_2 = ChildExampleViewController(itemInfo: "View")
5050
let child_3 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 2")
5151
let child_4 = ChildExampleViewController(itemInfo: "View 2")
52-
52+
5353
guard isReload else {
5454
return [child_1, child_2, child_3, child_4]
5555
}
56-
56+
5757
var childViewControllers = [child_1, child_2, child_3, child_4]
58-
for (index, _) in childViewControllers.enumerated(){
58+
for index in childViewControllers.indices {
5959
let nElements = childViewControllers.count - index
6060
let n = (Int(arc4random()) % nElements) + index
61-
if n != index{
62-
swap(&childViewControllers[index], &childViewControllers[n])
61+
if n != index {
62+
childViewControllers.swapAt(index, n)
6363
}
6464
}
6565
let nItems = 1 + (arc4random() % 4)
6666
return Array(childViewControllers.prefix(Int(nItems)))
6767
}
68-
68+
6969
override func reloadPagerTabStripView() {
7070
isReload = true
7171
if arc4random() % 2 == 0 {
7272
pagerBehaviour = .progressive(skipIntermediateViewControllers: arc4random() % 2 == 0, elasticIndicatorLimit: arc4random() % 2 == 0 )
73-
}
74-
else {
73+
} else {
7574
pagerBehaviour = .common(skipIntermediateViewControllers: arc4random() % 2 == 0)
7675
}
7776
super.reloadPagerTabStripView()

Example/Example/ButtonBarExampleViewController.swift

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ import Foundation
2626
import XLPagerTabStrip
2727

2828
class ButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
29-
29+
3030
var isReload = false
31-
31+
3232
override func viewDidLoad() {
3333
super.viewDidLoad()
34-
34+
3535
buttonBarView.selectedBar.backgroundColor = .orange
3636
buttonBarView.backgroundColor = UIColor(red: 7/255, green: 185/255, blue: 155/255, alpha: 1)
3737
}
38-
38+
3939
// MARK: - PagerTabStripDataSource
40-
40+
4141
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
4242
let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "Table View")
4343
let child_2 = ChildExampleViewController(itemInfo: "View")
@@ -47,30 +47,29 @@ class ButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
4747
let child_6 = ChildExampleViewController(itemInfo: "View 3")
4848
let child_7 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 4")
4949
let child_8 = ChildExampleViewController(itemInfo: "View 4")
50-
50+
5151
guard isReload else {
5252
return [child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8]
5353
}
54-
55-
var childViewControllers = [child_1, child_2, child_3, child_4, child_6, child_7, child_8]
56-
57-
for (index, _) in childViewControllers.enumerated(){
54+
55+
var childViewControllers = [child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8]
56+
57+
for index in childViewControllers.indices {
5858
let nElements = childViewControllers.count - index
5959
let n = (Int(arc4random()) % nElements) + index
60-
if n != index{
61-
swap(&childViewControllers[index], &childViewControllers[n])
60+
if n != index {
61+
childViewControllers.swapAt(index, n)
6262
}
6363
}
6464
let nItems = 1 + (arc4random() % 8)
6565
return Array(childViewControllers.prefix(Int(nItems)))
6666
}
67-
67+
6868
override func reloadPagerTabStripView() {
6969
isReload = true
7070
if arc4random() % 2 == 0 {
7171
pagerBehaviour = .progressive(skipIntermediateViewControllers: arc4random() % 2 == 0, elasticIndicatorLimit: arc4random() % 2 == 0 )
72-
}
73-
else {
72+
} else {
7473
pagerBehaviour = .common(skipIntermediateViewControllers: arc4random() % 2 == 0)
7574
}
7675
super.reloadPagerTabStripView()

Example/Example/ChildControllers/ChildExampleViewController.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import Foundation
2626
import XLPagerTabStrip
2727

2828
class ChildExampleViewController: UIViewController, IndicatorInfoProvider {
29-
29+
3030
var itemInfo: IndicatorInfo = "View"
31-
31+
3232
init(itemInfo: IndicatorInfo) {
3333
self.itemInfo = itemInfo
3434
super.init(nibName: nil, bundle: nil)
@@ -37,23 +37,23 @@ class ChildExampleViewController: UIViewController, IndicatorInfoProvider {
3737
required init?(coder aDecoder: NSCoder) {
3838
fatalError("init(coder:) has not been implemented")
3939
}
40-
40+
4141
override func viewDidLoad() {
4242
super.viewDidLoad()
43-
43+
4444
let label = UILabel()
4545
label.translatesAutoresizingMaskIntoConstraints = false
4646
label.text = "XLPagerTabStrip"
47-
47+
4848
view.addSubview(label)
4949
view.backgroundColor = .white
50-
50+
5151
view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0))
5252
view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerY, relatedBy: .equal, toItem: view, attribute: .centerY, multiplier: 1, constant: -50))
5353
}
54-
54+
5555
// MARK: - IndicatorInfoProvider
56-
56+
5757
func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
5858
return itemInfo
5959
}

0 commit comments

Comments
 (0)