diff --git a/.travis.yml b/.travis.yml index 2022ed9..a7234a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: objective-c -osx_image: xcode7.3 +osx_image: xcode8 env: - - DESTINATION="OS=9.3,name=iPhone 6s" SCHEME="XLPagerTabStrip" SDK=iphonesimulator9.3 + - DESTINATION="OS=10.0,name=iPhone 6s" SCHEME="XLPagerTabStrip" SDK=iphonesimulator10.0 before_install: - brew update #- brew outdated carthage || brew upgrade carthage @@ -10,7 +10,7 @@ before_install: - gem install xcpretty --no-rdoc --no-ri --no-document --quiet script: -- xctool clean build -project XLPagerTabStrip.xcodeproj -scheme XLPagerTabStrip -sdk iphonesimulator9.3 -#- xctool test -project XLPagerTabStrip.xcodeproj -scheme XLPagerTabStrip -sdk iphonesimulator9.3 +- xcodebuild clean build -project XLPagerTabStrip.xcodeproj -scheme "$SCHEME" -sdk "$SDK" +#- xcodebuild test -project XLPagerTabStrip.xcodeproj -scheme "$SCHEME" -sdk "$SDK" - xcodebuild -project XLPagerTabStrip.xcodeproj -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO test | xcpretty -c diff --git a/Example.xcodeproj/project.pbxproj b/Example.xcodeproj/project.pbxproj index a2bb771..11cb089 100644 --- a/Example.xcodeproj/project.pbxproj +++ b/Example.xcodeproj/project.pbxproj @@ -295,13 +295,15 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0720; + LastUpgradeCheck = 0800; TargetAttributes = { 28F828CB1C4B714D00330CF4 = { CreatedOnToolsVersion = 7.2; + LastSwiftMigration = 0800; }; 28F828DF1C4B714D00330CF4 = { CreatedOnToolsVersion = 7.2; + LastSwiftMigration = 0800; TestTargetID = 28F828CB1C4B714D00330CF4; }; }; @@ -441,8 +443,10 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -485,8 +489,10 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -505,6 +511,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.2; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; name = Release; @@ -512,29 +519,31 @@ 28F828EA1C4B714D00330CF4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; INFOPLIST_FILE = "$(SRCROOT)/Example/Example/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.Example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; }; name = Debug; }; 28F828EB1C4B714D00330CF4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; INFOPLIST_FILE = "$(SRCROOT)/Example/Example/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.Example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = ""; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -547,6 +556,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.ExampleUITests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; TEST_TARGET_NAME = Example; USES_XCTRUNNER = YES; }; @@ -560,6 +570,7 @@ 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; TEST_TARGET_NAME = Example; USES_XCTRUNNER = YES; }; diff --git a/Example/Example/AppDelegate.swift b/Example/Example/AppDelegate.swift index e6f521a..0bf0166 100644 --- a/Example/Example/AppDelegate.swift +++ b/Example/Example/AppDelegate.swift @@ -13,36 +13,36 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. UITabBar.appearance().tintColor = UIColor.init(red: 0.027, green: 0.725, blue: 0.608, alpha: 1) - UIApplication.sharedApplication().statusBarStyle = .LightContent + UIApplication.shared.statusBarStyle = .lightContent let _ = YoutubeExampleViewController(nibName: nil, bundle: nil) return true } - func applicationWillResignActive(application: UIApplication) { + func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - func applicationDidEnterBackground(application: UIApplication) { + func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - func applicationWillEnterForeground(application: UIApplication) { + func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - func applicationDidBecomeActive(application: UIApplication) { + func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - func applicationWillTerminate(application: UIApplication) { + func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } diff --git a/Example/Example/BarExampleViewController.swift b/Example/Example/BarExampleViewController.swift index 99e80e2..c8263e4 100644 --- a/Example/Example/BarExampleViewController.swift +++ b/Example/Example/BarExampleViewController.swift @@ -35,7 +35,7 @@ class BarExampleViewController: BarPagerTabStripViewController { override func viewDidLoad() { // set up style before super view did load is executed - settings.style.selectedBarBackgroundColor = .orangeColor() + settings.style.selectedBarBackgroundColor = .orange // - super.viewDidLoad() @@ -43,11 +43,11 @@ class BarExampleViewController: BarPagerTabStripViewController { // MARK: - PagerTabStripDataSource - override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { + override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { - let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View") + let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "Table View") let child_2 = ChildExampleViewController(itemInfo: "View") - let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2") + let child_3 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 2") let child_4 = ChildExampleViewController(itemInfo: "View 2") guard isReload else { @@ -55,24 +55,24 @@ class BarExampleViewController: BarPagerTabStripViewController { } var childViewControllers = [child_1, child_2, child_3, child_4] - for (index, _) in childViewControllers.enumerate(){ + for (index, _) in childViewControllers.enumerated(){ let nElements = childViewControllers.count - index let n = (Int(arc4random()) % nElements) + index if n != index{ swap(&childViewControllers[index], &childViewControllers[n]) } } - let nItems = 1 + (rand() % 4) + let nItems = 1 + (arc4random() % 4) return Array(childViewControllers.prefix(Int(nItems))) } override func reloadPagerTabStripView() { isReload = true - if rand() % 2 == 0 { - pagerBehaviour = .Progressive(skipIntermediateViewControllers: rand() % 2 == 0 , elasticIndicatorLimit: rand() % 2 == 0 ) + if arc4random() % 2 == 0 { + pagerBehaviour = .progressive(skipIntermediateViewControllers: arc4random() % 2 == 0 , elasticIndicatorLimit: arc4random() % 2 == 0 ) } else { - pagerBehaviour = .Common(skipIntermediateViewControllers: rand() % 2 == 0) + pagerBehaviour = .common(skipIntermediateViewControllers: arc4random() % 2 == 0) } super.reloadPagerTabStripView() } diff --git a/Example/Example/ButtonBarExampleViewController.swift b/Example/Example/ButtonBarExampleViewController.swift index 9574796..1ab15a2 100644 --- a/Example/Example/ButtonBarExampleViewController.swift +++ b/Example/Example/ButtonBarExampleViewController.swift @@ -32,20 +32,20 @@ class ButtonBarExampleViewController: ButtonBarPagerTabStripViewController { override func viewDidLoad() { super.viewDidLoad() - buttonBarView.selectedBar.backgroundColor = .orangeColor() + buttonBarView.selectedBar.backgroundColor = .orange buttonBarView.backgroundColor = UIColor(red: 7/255, green: 185/255, blue: 155/255, alpha: 1) } // MARK: - PagerTabStripDataSource - override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { - let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View") + override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { + let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "Table View") let child_2 = ChildExampleViewController(itemInfo: "View") - let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2") + let child_3 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 2") let child_4 = ChildExampleViewController(itemInfo: "View 2") - let child_5 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View 3") + let child_5 = TableChildExampleViewController(style: .plain, itemInfo: "Table View 3") let child_6 = ChildExampleViewController(itemInfo: "View 3") - let child_7 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 4") + let child_7 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 4") let child_8 = ChildExampleViewController(itemInfo: "View 4") guard isReload else { @@ -54,24 +54,24 @@ class ButtonBarExampleViewController: ButtonBarPagerTabStripViewController { var childViewControllers = [child_1, child_2, child_3, child_4, child_6, child_7, child_8] - for (index, _) in childViewControllers.enumerate(){ + for (index, _) in childViewControllers.enumerated(){ let nElements = childViewControllers.count - index let n = (Int(arc4random()) % nElements) + index if n != index{ swap(&childViewControllers[index], &childViewControllers[n]) } } - let nItems = 1 + (rand() % 8) + let nItems = 1 + (arc4random() % 8) return Array(childViewControllers.prefix(Int(nItems))) } override func reloadPagerTabStripView() { isReload = true - if rand() % 2 == 0 { - pagerBehaviour = .Progressive(skipIntermediateViewControllers: rand() % 2 == 0 , elasticIndicatorLimit: rand() % 2 == 0 ) + if arc4random() % 2 == 0 { + pagerBehaviour = .progressive(skipIntermediateViewControllers: arc4random() % 2 == 0 , elasticIndicatorLimit: arc4random() % 2 == 0 ) } else { - pagerBehaviour = .Common(skipIntermediateViewControllers: rand() % 2 == 0) + pagerBehaviour = .common(skipIntermediateViewControllers: arc4random() % 2 == 0) } super.reloadPagerTabStripView() } diff --git a/Example/Example/ChildControllers/ChildExampleViewController.swift b/Example/Example/ChildControllers/ChildExampleViewController.swift index 1da1798..fe11b3b 100644 --- a/Example/Example/ChildControllers/ChildExampleViewController.swift +++ b/Example/Example/ChildControllers/ChildExampleViewController.swift @@ -46,15 +46,15 @@ class ChildExampleViewController: UIViewController, IndicatorInfoProvider { label.text = "XLPagerTabStrip" view.addSubview(label) - view.backgroundColor = .whiteColor() + view.backgroundColor = .white - view.addConstraint(NSLayoutConstraint(item: label, attribute: .CenterX, relatedBy: .Equal, toItem: view, attribute: .CenterX, multiplier: 1, constant: 0)) - view.addConstraint(NSLayoutConstraint(item: label, attribute: .CenterY, relatedBy: .Equal, toItem: view, attribute: .CenterY, multiplier: 1, constant: -50)) + view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0)) + view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerY, relatedBy: .equal, toItem: view, attribute: .centerY, multiplier: 1, constant: -50)) } // MARK: - IndicatorInfoProvider - func indicatorInfoForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo { + func indicatorInfoForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo { return itemInfo } } diff --git a/Example/Example/ChildControllers/TableChildExampleViewController.swift b/Example/Example/ChildControllers/TableChildExampleViewController.swift index 577efe0..0bb2b8b 100644 --- a/Example/Example/ChildControllers/TableChildExampleViewController.swift +++ b/Example/Example/ChildControllers/TableChildExampleViewController.swift @@ -42,7 +42,7 @@ class TableChildExampleViewController: UITableViewController, IndicatorInfoProvi override func viewDidLoad() { super.viewDidLoad() - tableView.registerNib(UINib(nibName: "PostCell", bundle: NSBundle.mainBundle()), forCellReuseIdentifier: cellIdentifier) + tableView.register(UINib(nibName: "PostCell", bundle: Bundle.main), forCellReuseIdentifier: cellIdentifier) tableView.estimatedRowHeight = 60.0; tableView.rowHeight = UITableViewAutomaticDimension tableView.allowsSelection = false @@ -51,24 +51,24 @@ class TableChildExampleViewController: UITableViewController, IndicatorInfoProvi } } - override func viewWillAppear(animated: Bool) { + override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) tableView.reloadData() } // MARK: - UITableViewDataSource - override func numberOfSectionsInTableView(tableView: UITableView) -> Int { + override func numberOfSections(in tableView: UITableView) -> Int { return 1 } - override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return DataProvider.sharedInstance.postsData.count } - - override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! PostCell - let data = DataProvider.sharedInstance.postsData.objectAtIndex(indexPath.row) as! + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! PostCell + let data = DataProvider.sharedInstance.postsData.object(at: indexPath.row) as! NSDictionary cell.configureWithData(data) if blackTheme { @@ -79,7 +79,7 @@ class TableChildExampleViewController: UITableViewController, IndicatorInfoProvi // MARK: - IndicatorInfoProvider - func indicatorInfoForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo { + func indicatorInfoForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo { return itemInfo } } diff --git a/Example/Example/Helpers/DataProvider.swift b/Example/Example/Helpers/DataProvider.swift index 30b8189..92ce141 100644 --- a/Example/Example/Helpers/DataProvider.swift +++ b/Example/Example/Helpers/DataProvider.swift @@ -30,16 +30,16 @@ class DataProvider { lazy var postsData: NSArray = { let jsonStr = "[{\"post\":{\"id\":113,\"text\":\"We're getting fifty percent of the t-shirt sales\",\"created_at\":\"2014-04-17T00:45:40.556Z\",\"user\":{\"id\":9,\"name\":\"Lisa Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Lisa_Simpsons.png\"}}},{\"post\":{\"id\":66,\"text\":\"Eep!\",\"created_at\":\"2014-04-09T21:29:59.982Z\",\"user\":{\"id\":7,\"name\":\"Bart Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Bart_Simpsons.png\"}}},{\"post\":{\"id\":42,\"text\":\"I'm not thinking straight, why did I have that wine cooler last month?\",\"created_at\":\"2014-04-09T17:58:41.704Z\",\"user\":{\"id\":5,\"name\":\"Ned Flanders\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Ned_Flanders.png\"}}},{\"post\":{\"id\":84,\"text\":\"Son, when you participate in sporting events, it's not whether you win or lose: it's how drunk you get.\",\"created_at\":\"2014-04-03T20:21:32.119Z\",\"user\":{\"id\":8,\"name\":\"Homer Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Homer_Simpsons.png\"}}},{\"post\":{\"id\":75,\"text\":\"I'm normally not a praying man, but if you're up there, please save me Superman.\",\"created_at\":\"2014-04-03T02:04:43.053Z\",\"user\":{\"id\":8,\"name\":\"Homer Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Homer_Simpsons.png\"}}},{\"post\":{\"id\":26,\"text\":\"Homer, please get rid of that pig.\",\"created_at\":\"2014-04-02T03:48:56.381Z\",\"user\":{\"id\":3,\"name\":\"Marge Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Marge_Simpsons.png\"}}},{\"post\":{\"id\":40,\"text\":\"You sold weapon-grade plutoneum to the Iraqies without a mark up.\",\"created_at\":\"2014-03-28T05:23:24.657Z\",\"user\":{\"id\":4,\"name\":\"Montgomery Burns\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Montgomery_Burns.png\"}}},{\"post\":{\"id\":28,\"text\":\"Homer, don't say that. The way I see it, if you raised three children who can knock out and hog tie a perfect stranger you must be doing something right.\",\"created_at\":\"2014-03-22T14:24:22.408Z\",\"user\":{\"id\":3,\"name\":\"Marge Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Marge_Simpsons.png\"}}},{\"post\":{\"id\":48,\"text\":\"Hi-dilly-ho, neighborinos!\",\"created_at\":\"2014-03-21T08:39:20.764Z\",\"user\":{\"id\":5,\"name\":\"Ned Flanders\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Ned_Flanders.png\"}}},{\"post\":{\"id\":78,\"text\":\"Maybe, just once, someone will call me 'Sir' without adding, 'You're making a scene.'\",\"created_at\":\"2014-03-20T02:44:28.075Z\",\"user\":{\"id\":8,\"name\":\"Homer Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Homer_Simpsons.png\"}}},{\"post\":{\"id\":33,\"text\":\"This is the type of trickery I pay you for.\",\"created_at\":\"2014-03-18T08:25:14.507Z\",\"user\":{\"id\":4,\"name\":\"Montgomery Burns\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Montgomery_Burns.png\"}}},{\"post\":{\"id\":72,\"text\":\"Oh, so they have internet on computers now!\",\"created_at\":\"2014-03-03T19:02:56.032Z\",\"user\":{\"id\":8,\"name\":\"Homer Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Homer_Simpsons.png\"}}},{\"post\":{\"id\":1,\"text\":\"You know, I do! I mean, there comes a time in a man's life when he asks himself, 'who will float my corpse down the Ganges?'\",\"created_at\":\"2014-02-24T14:09:00.912Z\",\"user\":{\"id\":1,\"name\":\"Apu Nahasapeemapetilon\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Apu_Nahasapeemapetilon.png\"}}},{\"post\":{\"id\":62,\"text\":\"Ay Caramba!\",\"created_at\":\"2014-02-18T16:38:37.958Z\",\"user\":{\"id\":7,\"name\":\"Bart Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Bart_Simpsons.png\"}}},{\"post\":{\"id\":19,\"text\":\"Throughout the ages, the finger painter, the Play-Doh sculptor, the Lincoln Logger, stood alone against the daycare teacher of her time. She did not live to earn aproval stickers, she lived for herself, that she might achieve things that are the glory of all humanity. These are my terms. I do not care to play by any others. And now, if the jury will allow me, it's naptime.\",\"created_at\":\"2014-02-16T22:11:33.236Z\",\"user\":{\"id\":2,\"name\":\"Maggie Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Maggie_Simpsons.png\"}}},{\"post\":{\"id\":76,\"text\":\"Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers.\",\"created_at\":\"2014-02-16T19:09:55.062Z\",\"user\":{\"id\":8,\"name\":\"Homer Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Homer_Simpsons.png\"}}},{\"post\":{\"id\":22,\"text\":\"Somebody throw the goddamn bomb!\",\"created_at\":\"2014-02-16T13:50:25.313Z\",\"user\":{\"id\":3,\"name\":\"Marge Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Marge_Simpsons.png\"}}},{\"post\":{\"id\":36,\"text\":\"Oh, so mother nature needs a favor? Well, maybe she should have thought of that when she was besetting us with droughts and floods and poison monkeys.\",\"created_at\":\"2014-02-13T06:51:57.549Z\",\"user\":{\"id\":4,\"name\":\"Montgomery Burns\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Montgomery_Burns.png\"}}}]" - let jsonData = jsonStr.dataUsingEncoding(NSUTF8StringEncoding) - return try! NSJSONSerialization.JSONObjectWithData(jsonData!, options: []) as! NSArray + let jsonData = jsonStr.data(using: String.Encoding.utf8) + return try! JSONSerialization.jsonObject(with: jsonData!, options: []) as! NSArray }() } class NavController: UINavigationController { - override func preferredStatusBarStyle() -> UIStatusBarStyle { - return UIStatusBarStyle.LightContent + override var preferredStatusBarStyle : UIStatusBarStyle { + return UIStatusBarStyle.lightContent } } @@ -47,8 +47,8 @@ class NavController: UINavigationController { class TabBarController : UITabBarController { - override func preferredStatusBarStyle() -> UIStatusBarStyle { - return UIStatusBarStyle.LightContent + override var preferredStatusBarStyle : UIStatusBarStyle { + return UIStatusBarStyle.lightContent } } diff --git a/Example/Example/Helpers/PostCell.swift b/Example/Example/Helpers/PostCell.swift index 149ed34..3a11c29 100644 --- a/Example/Example/Helpers/PostCell.swift +++ b/Example/Example/Helpers/PostCell.swift @@ -37,18 +37,20 @@ class PostCell: UITableViewCell { } - func configureWithData(data: NSDictionary){ - postName.text = data["post"]!["user"]!!["name"] as? String - postText.text = data["post"]!["text"] as? String - userImage.image = UIImage(named: postName.text!.stringByReplacingOccurrencesOfString(" ", withString: "_")) + func configureWithData(_ data: NSDictionary){ + if let post = data["post"] as? NSDictionary, let user = post["user"] as? NSDictionary { + postName.text = user["name"] as? String + postText.text = post["text"] as? String + userImage.image = UIImage(named: postName.text!.replacingOccurrences(of: " ", with: "_")) + } } func changeStylToBlack(){ userImage?.layer.cornerRadius = 30.0 postText.text = nil - postName.font = UIFont(name: "HelveticaNeue-Light", size:18) ?? UIFont.systemFontOfSize(18) - postName.textColor = .whiteColor() + postName.font = UIFont(name: "HelveticaNeue-Light", size:18) ?? UIFont.systemFont(ofSize: 18) + postName.textColor = .white backgroundColor = UIColor(red: 15/255.0, green: 16/255.0, blue: 16/255.0, alpha: 1.0) } } diff --git a/Example/Example/Instagram/InstagramExampleViewController.swift b/Example/Example/Instagram/InstagramExampleViewController.swift index b47d707..31ef89a 100644 --- a/Example/Example/Instagram/InstagramExampleViewController.swift +++ b/Example/Example/Instagram/InstagramExampleViewController.swift @@ -32,20 +32,20 @@ class InstagramExampleViewController: ButtonBarPagerTabStripViewController { override func viewDidLoad() { // change selected bar color - settings.style.buttonBarBackgroundColor = .whiteColor() - settings.style.buttonBarItemBackgroundColor = .whiteColor() + settings.style.buttonBarBackgroundColor = .white + settings.style.buttonBarItemBackgroundColor = .white settings.style.selectedBarBackgroundColor = blueInstagramColor - settings.style.buttonBarItemFont = .boldSystemFontOfSize(14) + settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 14) settings.style.selectedBarHeight = 2.0 settings.style.buttonBarMinimumLineSpacing = 0 - settings.style.buttonBarItemTitleColor = .blackColor() + settings.style.buttonBarItemTitleColor = .black settings.style.buttonBarItemsShouldFillAvailiableWidth = true settings.style.buttonBarLeftContentInset = 0 settings.style.buttonBarRightContentInset = 0 changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in guard changeCurrentIndex == true else { return } - oldCell?.label.textColor = .blackColor() + oldCell?.label.textColor = .black newCell?.label.textColor = self?.blueInstagramColor } super.viewDidLoad() @@ -53,16 +53,16 @@ class InstagramExampleViewController: ButtonBarPagerTabStripViewController { // MARK: - PagerTabStripDataSource - override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { - let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "FOLLOWING") + override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { + let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "FOLLOWING") let child_2 = ChildExampleViewController(itemInfo: "YOU") return [child_1, child_2] } // MARK: - Custom Action - @IBAction func closeAction(sender: UIButton) { - dismissViewControllerAnimated(true, completion: nil) + @IBAction func closeAction(_ sender: UIButton) { + dismiss(animated: true, completion: nil) } } diff --git a/Example/Example/NavButtonBarExampleViewController.swift b/Example/Example/NavButtonBarExampleViewController.swift index 12dd99c..83bf21a 100644 --- a/Example/Example/NavButtonBarExampleViewController.swift +++ b/Example/Example/NavButtonBarExampleViewController.swift @@ -30,8 +30,8 @@ class NavButtonBarExampleViewController: ButtonBarPagerTabStripViewController { override func viewDidLoad() { // set up style before super view did load is executed - settings.style.buttonBarBackgroundColor = .clearColor() - settings.style.selectedBarBackgroundColor = .orangeColor() + settings.style.buttonBarBackgroundColor = .clear + settings.style.selectedBarBackgroundColor = .orange //- super.viewDidLoad() @@ -42,31 +42,31 @@ class NavButtonBarExampleViewController: ButtonBarPagerTabStripViewController { guard changeCurrentIndex == true else { return } oldCell?.label.textColor = UIColor(white: 1, alpha: 0.6) - newCell?.label.textColor = .whiteColor() + newCell?.label.textColor = .white if animated { - UIView.animateWithDuration(0.1, animations: { () -> Void in - newCell?.transform = CGAffineTransformMakeScale(1.0, 1.0) - oldCell?.transform = CGAffineTransformMakeScale(0.8, 0.8) + UIView.animate(withDuration: 0.1, animations: { () -> Void in + newCell?.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) + oldCell?.transform = CGAffineTransform(scaleX: 0.8, y: 0.8) }) } else { - newCell?.transform = CGAffineTransformMakeScale(1.0, 1.0) - oldCell?.transform = CGAffineTransformMakeScale(0.8, 0.8) + newCell?.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) + oldCell?.transform = CGAffineTransform(scaleX: 0.8, y: 0.8) } } } // MARK: - PagerTabStripDataSource - override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { - let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View") + override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { + let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "Table View") let child_2 = ChildExampleViewController(itemInfo: "View") - let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2") + let child_3 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 2") let child_4 = ChildExampleViewController(itemInfo: "View 1") - let child_5 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View 3") + let child_5 = TableChildExampleViewController(style: .plain, itemInfo: "Table View 3") let child_6 = ChildExampleViewController(itemInfo: "View 2") - let child_7 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 4") + let child_7 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 4") let child_8 = ChildExampleViewController(itemInfo: "View 3") guard isReload else { @@ -75,30 +75,30 @@ class NavButtonBarExampleViewController: ButtonBarPagerTabStripViewController { var childViewControllers = [child_1, child_2, child_3, child_4, child_6, child_7, child_8] - for (index, _) in childViewControllers.enumerate(){ + for (index, _) in childViewControllers.enumerated(){ let nElements = childViewControllers.count - index let n = (Int(arc4random()) % nElements) + index if n != index{ swap(&childViewControllers[index], &childViewControllers[n]) } } - let nItems = 1 + (rand() % 8) + let nItems = 1 + (arc4random() % 8) return Array(childViewControllers.prefix(Int(nItems))) } override func reloadPagerTabStripView() { isReload = true - if rand() % 2 == 0 { - pagerBehaviour = .Progressive(skipIntermediateViewControllers: rand() % 2 == 0 , elasticIndicatorLimit: rand() % 2 == 0 ) + if arc4random() % 2 == 0 { + pagerBehaviour = .progressive(skipIntermediateViewControllers: arc4random() % 2 == 0 , elasticIndicatorLimit: arc4random() % 2 == 0 ) } else { - pagerBehaviour = .Common(skipIntermediateViewControllers: rand() % 2 == 0) + pagerBehaviour = .common(skipIntermediateViewControllers: arc4random() % 2 == 0) } super.reloadPagerTabStripView() } - override func configureCell(cell: ButtonBarViewCell, indicatorInfo: IndicatorInfo) { + override func configureCell(_ cell: ButtonBarViewCell, indicatorInfo: IndicatorInfo) { super.configureCell(cell, indicatorInfo: indicatorInfo) - cell.backgroundColor = .clearColor() + cell.backgroundColor = .clear } } diff --git a/Example/Example/ReloadExampleViewController.swift b/Example/Example/ReloadExampleViewController.swift index 8db1b88..29e9de4 100644 --- a/Example/Example/ReloadExampleViewController.swift +++ b/Example/Example/ReloadExampleViewController.swift @@ -34,9 +34,9 @@ class ReloadExampleViewController: UIViewController { lazy var bigLabel: UILabel = { let bigLabel = UILabel() - bigLabel.backgroundColor = .clearColor() - bigLabel.textColor = .whiteColor() - bigLabel.font = UIFont.boldSystemFontOfSize(20) + bigLabel.backgroundColor = .clear + bigLabel.textColor = .white + bigLabel.font = UIFont.boldSystemFont(ofSize: 20) bigLabel.adjustsFontSizeToFitWidth = true return bigLabel }() @@ -54,7 +54,7 @@ class ReloadExampleViewController: UIViewController { } } - @IBAction func reloadTapped(sender: UIBarButtonItem) { + @IBAction func reloadTapped(_ sender: UIBarButtonItem) { for childViewController in childViewControllers { guard let child = childViewController as? PagerTabStripViewController else { continue @@ -66,12 +66,12 @@ class ReloadExampleViewController: UIViewController { } - @IBAction func closeTapped(sender: UIButton) { - dismissViewControllerAnimated(true, completion: nil) + @IBAction func closeTapped(_ sender: UIButton) { + dismiss(animated: true, completion: nil) } - func updateTitle(pagerTabStripViewController: PagerTabStripViewController) { - func stringFromBool(bool: Bool) -> String { + func updateTitle(_ pagerTabStripViewController: PagerTabStripViewController) { + func stringFromBool(_ bool: Bool) -> String { return bool ? "YES" : "NO" } @@ -81,7 +81,7 @@ class ReloadExampleViewController: UIViewController { navigationItem.titleView?.sizeToFit() } - override func preferredStatusBarStyle() -> UIStatusBarStyle { - return .LightContent + override var preferredStatusBarStyle : UIStatusBarStyle { + return .lightContent } } diff --git a/Example/Example/SegmentedExampleViewController.swift b/Example/Example/SegmentedExampleViewController.swift index 1b6482e..19b9947 100644 --- a/Example/Example/SegmentedExampleViewController.swift +++ b/Example/Example/SegmentedExampleViewController.swift @@ -32,15 +32,15 @@ class SegmentedExampleViewController: SegmentedPagerTabStripViewController { required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) // change segmented style - settings.style.segmentedControlColor = .whiteColor() + settings.style.segmentedControlColor = .white } // MARK: - PagerTabStripDataSource - override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { - let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View") + override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { + let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "Table View") let child_2 = ChildExampleViewController(itemInfo: "View") - let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2") + let child_3 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 2") let child_4 = ChildExampleViewController(itemInfo: "View 2") guard isReload else { @@ -50,21 +50,20 @@ class SegmentedExampleViewController: SegmentedPagerTabStripViewController { var childViewControllers = [child_1, child_2, child_3, child_4] let count = childViewControllers.count - for (index, _) in childViewControllers.enumerate(){ + for (index, _) in childViewControllers.enumerated(){ let nElements = count - index let n = (Int(arc4random()) % nElements) + index if n != index{ swap(&childViewControllers[index], &childViewControllers[n]) } } - let nItems = 1 + (rand() % 4) + let nItems = 1 + (arc4random() % 4) return Array(childViewControllers.prefix(Int(nItems))) } - @IBAction func reloadTapped(sender: UIBarButtonItem) { + @IBAction func reloadTapped(_ sender: UIBarButtonItem) { isReload = true - pagerBehaviour = .Common(skipIntermediateViewControllers: rand() % 2 == 0) - pagerBehaviour.skipIntermediateViewControllers + pagerBehaviour = .common(skipIntermediateViewControllers: arc4random() % 2 == 0) reloadPagerTabStripView() } } diff --git a/Example/Example/Spotify/SpotifyExampleViewController.swift b/Example/Example/Spotify/SpotifyExampleViewController.swift index c45cb42..a62c09c 100644 --- a/Example/Example/Spotify/SpotifyExampleViewController.swift +++ b/Example/Example/Spotify/SpotifyExampleViewController.swift @@ -25,22 +25,22 @@ import Foundation import XLPagerTabStrip -public class SpotifyExampleViewController: ButtonBarPagerTabStripViewController { +open class SpotifyExampleViewController: ButtonBarPagerTabStripViewController { @IBOutlet weak var shadowView: UIView! let graySpotifyColor = UIColor(red: 21/255.0, green: 21/255.0, blue: 24/255.0, alpha: 1.0) let darkGraySpotifyColor = UIColor(red: 19/255.0, green: 20/255.0, blue: 20/255.0, alpha: 1.0) - public override func viewDidLoad() { + open override func viewDidLoad() { // change selected bar color settings.style.buttonBarBackgroundColor = graySpotifyColor settings.style.buttonBarItemBackgroundColor = graySpotifyColor settings.style.selectedBarBackgroundColor = UIColor(red: 33/255.0, green: 174/255.0, blue: 67/255.0, alpha: 1.0) - settings.style.buttonBarItemFont = UIFont(name: "HelveticaNeue-Light", size:14) ?? UIFont.systemFontOfSize(14) + settings.style.buttonBarItemFont = UIFont(name: "HelveticaNeue-Light", size:14) ?? UIFont.systemFont(ofSize: 14) settings.style.selectedBarHeight = 3.0 settings.style.buttonBarMinimumLineSpacing = 0 - settings.style.buttonBarItemTitleColor = .blackColor() + settings.style.buttonBarItemTitleColor = .black settings.style.buttonBarItemsShouldFillAvailiableWidth = true settings.style.buttonBarLeftContentInset = 20 @@ -49,25 +49,25 @@ public class SpotifyExampleViewController: ButtonBarPagerTabStripViewController changeCurrentIndexProgressive = { (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in guard changeCurrentIndex == true else { return } oldCell?.label.textColor = UIColor(red: 138/255.0, green: 138/255.0, blue: 144/255.0, alpha: 1.0) - newCell?.label.textColor = .whiteColor() + newCell?.label.textColor = .white } super.viewDidLoad() } // MARK: - PagerTabStripDataSource - public override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { - let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: IndicatorInfo(title: "FRIENDS")) + open override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { + let child_1 = TableChildExampleViewController(style: .plain, itemInfo: IndicatorInfo(title: "FRIENDS")) child_1.blackTheme = true - let child_2 = TableChildExampleViewController(style: .Plain, itemInfo: IndicatorInfo(title: "FEATURED")) + let child_2 = TableChildExampleViewController(style: .plain, itemInfo: IndicatorInfo(title: "FEATURED")) child_2.blackTheme = true return [child_1, child_2] } // MARK: - Actions - @IBAction func closeAction(sender: UIButton) { - dismissViewControllerAnimated(true, completion: nil) + @IBAction func closeAction(_ sender: UIButton) { + dismiss(animated: true, completion: nil) } } diff --git a/Example/Example/TwitterExampleViewController.swift b/Example/Example/TwitterExampleViewController.swift index 260c09b..50cc6a1 100644 --- a/Example/Example/TwitterExampleViewController.swift +++ b/Example/Example/TwitterExampleViewController.swift @@ -28,15 +28,15 @@ import XLPagerTabStrip class TwitterExampleViewController: TwitterPagerTabStripViewController { var isReload = false - override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { + override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { - let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "TableView") + let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "TableView") let child_2 = ChildExampleViewController(itemInfo: "View") - let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "TableView 2") + let child_3 = TableChildExampleViewController(style: .grouped, itemInfo: "TableView 2") let child_4 = ChildExampleViewController(itemInfo: "View 2") - let child_5 = TableChildExampleViewController(style: .Plain, itemInfo: "TableView 3") + let child_5 = TableChildExampleViewController(style: .plain, itemInfo: "TableView 3") let child_6 = ChildExampleViewController(itemInfo: "View 3") - let child_7 = TableChildExampleViewController(style: .Grouped, itemInfo: "TableView 4") + let child_7 = TableChildExampleViewController(style: .grouped, itemInfo: "TableView 4") let child_8 = ChildExampleViewController(itemInfo: "View 4") guard isReload else { @@ -45,18 +45,18 @@ class TwitterExampleViewController: TwitterPagerTabStripViewController { var childViewControllers = [child_1, child_2, child_3, child_4, child_6, child_7, child_8] - for (index, _) in childViewControllers.enumerate(){ + for (index, _) in childViewControllers.enumerated(){ let nElements = childViewControllers.count - index let n = (Int(arc4random()) % nElements) + index if n != index{ swap(&childViewControllers[index], &childViewControllers[n]) } } - let nItems = 1 + (rand() % 8) + let nItems = 1 + (arc4random() % 8) return Array(childViewControllers.prefix(Int(nItems))) } - @IBAction func reloadTapped(sender: AnyObject) { + @IBAction func reloadTapped(_ sender: AnyObject) { isReload = true reloadPagerTabStripView() } diff --git a/Example/Example/Youtube/YoutubeExampleViewController.swift b/Example/Example/Youtube/YoutubeExampleViewController.swift index 7294e84..c9a781b 100644 --- a/Example/Example/Youtube/YoutubeExampleViewController.swift +++ b/Example/Example/Youtube/YoutubeExampleViewController.swift @@ -31,14 +31,14 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController CGFloat in + buttonBarItemSpec = ButtonBarItemSpec.nibFile(nibName: "YoutubeIconCell", bundle: Bundle(for: YoutubeIconCell.self), width: { (cell: IndicatorInfo) -> CGFloat in return 55.0 }) } @@ -46,11 +46,11 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController Void in guard changeCurrentIndex == true else { return } oldCell?.iconImage.tintColor = self?.unselectedIconColor - newCell?.iconImage.tintColor = .whiteColor() + newCell?.iconImage.tintColor = .white } super.viewDidLoad() navigationController?.navigationBar.shadowImage = UIImage() - navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default) + navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) } // MARK: - PagerTabStripDataSource - override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { - let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: IndicatorInfo(title: " HOME", image: UIImage(named: "home"))) - let child_2 = TableChildExampleViewController(style: .Plain, itemInfo: IndicatorInfo(title: " TRENDING", image: UIImage(named: "trending"))) + override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { + let child_1 = TableChildExampleViewController(style: .plain, itemInfo: IndicatorInfo(title: " HOME", image: UIImage(named: "home"))) + let child_2 = TableChildExampleViewController(style: .plain, itemInfo: IndicatorInfo(title: " TRENDING", image: UIImage(named: "trending"))) let child_3 = ChildExampleViewController(itemInfo: IndicatorInfo(title: " ACCOUNT", image: UIImage(named: "profile"))) return [child_1, child_2, child_3] } - override func configureCell(cell: YoutubeIconCell, indicatorInfo: IndicatorInfo) { - cell.iconImage.image = indicatorInfo.image?.imageWithRenderingMode(.AlwaysTemplate) + override func configureCell(_ cell: YoutubeIconCell, indicatorInfo: IndicatorInfo) { + cell.iconImage.image = indicatorInfo.image?.withRenderingMode(.alwaysTemplate) } - override func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) { + override func pagerTabStripViewController(_ pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) { super.pagerTabStripViewController(pagerTabStripViewController, updateIndicatorFromIndex: fromIndex, toIndex: toIndex, withProgressPercentage: progressPercentage, indexWasChanged: indexWasChanged) if indexWasChanged && toIndex > -1 && toIndex < viewControllers.count { let child = viewControllers[toIndex] as! IndicatorInfoProvider @@ -96,8 +96,8 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController