From ae722325b0c15928e3fbc7343cc934bed8c49b4c Mon Sep 17 00:00:00 2001 From: Yoshiyuki Kawashima Date: Fri, 8 Dec 2017 21:55:26 +0900 Subject: [PATCH 01/19] Add Example Youtube with Label Put image above title text fixes #495 --- Example.xcodeproj/project.pbxproj | 21 ++ .../Example/Base.lproj/Storyboard.storyboard | 184 +++++++++++++++--- .../YoutubeIconWithLabelCell.swift | 33 ++++ .../YoutubeIconWithLabelCell.xib | 55 ++++++ ...outubeWithLabelExampleViewController.swift | 99 ++++++++++ 5 files changed, 360 insertions(+), 32 deletions(-) create mode 100644 Example/Example/YoutubeWithLabel/YoutubeIconWithLabelCell.swift create mode 100644 Example/Example/YoutubeWithLabel/YoutubeIconWithLabelCell.xib create mode 100644 Example/Example/YoutubeWithLabel/YoutubeWithLabelExampleViewController.swift diff --git a/Example.xcodeproj/project.pbxproj b/Example.xcodeproj/project.pbxproj index 60cd609..cb8534a 100644 --- a/Example.xcodeproj/project.pbxproj +++ b/Example.xcodeproj/project.pbxproj @@ -7,6 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + 1F081A9E1FDABD1400B881EB /* YoutubeIconWithLabelCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F081A9B1FDABD1400B881EB /* YoutubeIconWithLabelCell.swift */; }; + 1F081A9F1FDABD1400B881EB /* YoutubeIconWithLabelCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1F081A9C1FDABD1400B881EB /* YoutubeIconWithLabelCell.xib */; }; + 1F081AA01FDABD1400B881EB /* YoutubeWithLabelExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F081A9D1FDABD1400B881EB /* YoutubeWithLabelExampleViewController.swift */; }; 285718181C568336004D7E7B /* DataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 285718171C568336004D7E7B /* DataProvider.swift */; }; 285DA2881C569AA2000908CA /* ChildExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 285DA2861C569AA2000908CA /* ChildExampleViewController.swift */; }; 285DA2891C569AA2000908CA /* TableChildExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 285DA2871C569AA2000908CA /* TableChildExampleViewController.swift */; }; @@ -78,6 +81,9 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 1F081A9B1FDABD1400B881EB /* YoutubeIconWithLabelCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YoutubeIconWithLabelCell.swift; sourceTree = ""; }; + 1F081A9C1FDABD1400B881EB /* YoutubeIconWithLabelCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = YoutubeIconWithLabelCell.xib; sourceTree = ""; }; + 1F081A9D1FDABD1400B881EB /* YoutubeWithLabelExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YoutubeWithLabelExampleViewController.swift; sourceTree = ""; }; 285718171C568336004D7E7B /* DataProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DataProvider.swift; path = Example/Helpers/DataProvider.swift; sourceTree = ""; }; 285DA2861C569AA2000908CA /* ChildExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ChildExampleViewController.swift; path = Example/ChildControllers/ChildExampleViewController.swift; sourceTree = ""; }; 285DA2871C569AA2000908CA /* TableChildExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TableChildExampleViewController.swift; path = Example/ChildControllers/TableChildExampleViewController.swift; sourceTree = ""; }; @@ -125,6 +131,17 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 1F081A9A1FDABD1400B881EB /* YoutubeWithLabel */ = { + isa = PBXGroup; + children = ( + 1F081A9B1FDABD1400B881EB /* YoutubeIconWithLabelCell.swift */, + 1F081A9C1FDABD1400B881EB /* YoutubeIconWithLabelCell.xib */, + 1F081A9D1FDABD1400B881EB /* YoutubeWithLabelExampleViewController.swift */, + ); + name = YoutubeWithLabel; + path = Example/YoutubeWithLabel; + sourceTree = ""; + }; 285718151C568285004D7E7B /* Helpers */ = { isa = PBXGroup; children = ( @@ -221,6 +238,7 @@ CB86ED6C1C4D6ED400DA463B /* Demo */ = { isa = PBXGroup; children = ( + 1F081A9A1FDABD1400B881EB /* YoutubeWithLabel */, 285DA2911C5A5945000908CA /* Youtube */, 285DA28E1C59C587000908CA /* Spotify */, 285DA28A1C59210F000908CA /* Instagram */, @@ -358,6 +376,7 @@ CB86ED801C4D6F0D00DA463B /* Assets.xcassets in Resources */, CB86ED941C4E89DD00DA463B /* PostCell.xib in Resources */, CBA0A2021C5032E100C5748C /* Storyboard.storyboard in Resources */, + 1F081A9F1FDABD1400B881EB /* YoutubeIconWithLabelCell.xib in Resources */, CB86ED811C4D6F0D00DA463B /* LaunchScreen.storyboard in Resources */, 285DA2971C5A6A36000908CA /* YoutubeIconCell.xib in Resources */, ); @@ -388,10 +407,12 @@ 285718181C568336004D7E7B /* DataProvider.swift in Sources */, CB2125DE1C52A80E002DAF42 /* TwitterExampleViewController.swift in Sources */, 285DA2891C569AA2000908CA /* TableChildExampleViewController.swift in Sources */, + 1F081A9E1FDABD1400B881EB /* YoutubeIconWithLabelCell.swift in Sources */, CBBD435F1C5274AE001A748E /* NavButtonBarExampleViewController.swift in Sources */, CB71C6F31C4FDDCE008EC806 /* PostCell.swift in Sources */, 285DA2931C5A596B000908CA /* YoutubeExampleViewController.swift in Sources */, 285DA2951C5A6A00000908CA /* YoutubeIconCell.swift in Sources */, + 1F081AA01FDABD1400B881EB /* YoutubeWithLabelExampleViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Example/Example/Base.lproj/Storyboard.storyboard b/Example/Example/Base.lproj/Storyboard.storyboard index b0b9adb..605b37b 100644 --- a/Example/Example/Base.lproj/Storyboard.storyboard +++ b/Example/Example/Base.lproj/Storyboard.storyboard @@ -1,11 +1,11 @@ - + - + @@ -20,7 +20,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -201,14 +201,14 @@ - + - + @@ -248,11 +248,11 @@ - + From 7fedf7172a52d1fd80198f7cba3c4544c0c54156 Mon Sep 17 00:00:00 2001 From: Sho Ikeda Date: Mon, 10 Sep 2018 23:44:43 +0900 Subject: [PATCH 17/19] Fix typo in README --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 496701c..f13edb7 100644 --- a/README.md +++ b/README.md @@ -145,26 +145,26 @@ public var pagerBehaviour: PagerTabStripBehaviour ```swift public enum PagerTabStripBehaviour { - case Common(skipIntermediteViewControllers: Bool) - case Progressive(skipIntermediteViewControllers: Bool, elasticIndicatorLimit: Bool) + case common(skipIntermediteViewControllers: Bool) + case progressive(skipIntermediteViewControllers: Bool, elasticIndicatorLimit: Bool) } ``` Default Values: ```swift // Twitter Type -PagerTabStripBehaviour.Common(skipIntermediteViewControllers: true) +PagerTabStripBehaviour.common(skipIntermediateViewControllers: true) // Segmented Type -PagerTabStripBehaviour.Common(skipIntermediteViewControllers: true) +PagerTabStripBehaviour.common(skipIntermediateViewControllers: true) // Bar Type -PagerTabStripBehaviour.Progressive(skipIntermediteViewControllers: true, elasticIndicatorLimit: true) +PagerTabStripBehaviour.progressive(skipIntermediateViewControllers: true, elasticIndicatorLimit: true) // ButtonBar Type -PagerTabStripBehaviour.Progressive(skipIntermediteViewControllers: true, elasticIndicatorLimit: true)` +PagerTabStripBehaviour.progressive(skipIntermediateViewControllers: true, elasticIndicatorLimit: true) ``` -As you might have noticed `Common` and `Progressive` enumeration cases has `skipIntermediteViewControllers` and `elasticIndicatorLimit` associated values. +As you might have noticed `common` and `progressive` enumeration cases has `skipIntermediateViewControllers` and `elasticIndicatorLimit` associated values. -`skipIntermediteViewControllers` allows us to skip intermediate view controllers when a tab indicator is tapped. +`skipIntermediateViewControllers` allows us to skip intermediate view controllers when a tab indicator is tapped. `elasticIndicatorLimit` allows us to tension the indicator when we reach a limit, I mean when we try to move forward from last indicator or move back from first indicator. From 56acdd94010dee9f7e363aec8052b607ab8c038a Mon Sep 17 00:00:00 2001 From: Alexander Khitev Date: Fri, 28 Sep 2018 18:02:48 +0400 Subject: [PATCH 18/19] updated to Swift 4.2 and added swift version to podspec (#617) --- ...ButtonBarPagerTabStripViewController.swift | 3 +-- Sources/ButtonBarViewCell.swift | 7 +++-- Sources/PagerTabStripViewController.swift | 26 +++++++++---------- XLPagerTabStrip.podspec | 1 + XLPagerTabStrip.xcodeproj/project.pbxproj | 8 +++--- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/Sources/ButtonBarPagerTabStripViewController.swift b/Sources/ButtonBarPagerTabStripViewController.swift index 86addf1..81df1db 100644 --- a/Sources/ButtonBarPagerTabStripViewController.swift +++ b/Sources/ButtonBarPagerTabStripViewController.swift @@ -349,8 +349,7 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa } cell.isAccessibilityElement = true cell.accessibilityLabel = cell.label.text - cell.accessibilityTraits |= UIAccessibilityTraitButton - cell.accessibilityTraits |= UIAccessibilityTraitHeader + cell.accessibilityTraits.insert([.button, .header]) return cell } diff --git a/Sources/ButtonBarViewCell.swift b/Sources/ButtonBarViewCell.swift index 933434b..4f60862 100644 --- a/Sources/ButtonBarViewCell.swift +++ b/Sources/ButtonBarViewCell.swift @@ -33,8 +33,7 @@ open class ButtonBarViewCell: UICollectionViewCell { super.init(coder: aDecoder) isAccessibilityElement = true - accessibilityTraits |= UIAccessibilityTraitButton - accessibilityTraits |= UIAccessibilityTraitHeader + accessibilityTraits.insert([.button, .header]) } open override var isSelected: Bool { @@ -44,9 +43,9 @@ open class ButtonBarViewCell: UICollectionViewCell { set { super.isSelected = newValue if (newValue) { - accessibilityTraits |= UIAccessibilityTraitSelected + accessibilityTraits.insert(.selected) } else { - accessibilityTraits &= ~UIAccessibilityTraitSelected + accessibilityTraits.remove(.selected) } } } diff --git a/Sources/PagerTabStripViewController.swift b/Sources/PagerTabStripViewController.swift index 41f47c4..d7e5551 100644 --- a/Sources/PagerTabStripViewController.swift +++ b/Sources/PagerTabStripViewController.swift @@ -105,16 +105,16 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate { reloadViewControllers() let childController = viewControllers[currentIndex] - addChildViewController(childController) + addChild(childController) childController.view.autoresizingMask = [.flexibleHeight, .flexibleWidth] containerView.addSubview(childController.view) - childController.didMove(toParentViewController: self) + childController.didMove(toParent: self) } open override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) isViewAppearing = true - childViewControllers.forEach { $0.beginAppearanceTransition(true, animated: animated) } + children.forEach { $0.beginAppearanceTransition(true, animated: animated) } } override open func viewDidAppear(_ animated: Bool) { @@ -126,17 +126,17 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate { moveToViewController(at: preCurrentIndex) } isViewAppearing = false - childViewControllers.forEach { $0.endAppearanceTransition() } + children.forEach { $0.endAppearanceTransition() } } open override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) - childViewControllers.forEach { $0.beginAppearanceTransition(false, animated: animated) } + children.forEach { $0.beginAppearanceTransition(false, animated: animated) } } open override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) - childViewControllers.forEach { $0.endAppearanceTransition() } + children.forEach { $0.endAppearanceTransition() } } override open func viewDidLayoutSubviews() { @@ -240,25 +240,25 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate { for (index, childController) in pagerViewControllers.enumerated() { let pageOffsetForChild = self.pageOffsetForChild(at: index) - if fabs(containerView.contentOffset.x - pageOffsetForChild) < containerView.bounds.width { + if abs(containerView.contentOffset.x - pageOffsetForChild) < containerView.bounds.width { if childController.parent != nil { childController.view.frame = CGRect(x: offsetForChild(at: index), y: 0, width: view.bounds.width, height: containerView.bounds.height) childController.view.autoresizingMask = [.flexibleHeight, .flexibleWidth] } else { childController.beginAppearanceTransition(true, animated: false) - addChildViewController(childController) + addChild(childController) childController.view.frame = CGRect(x: offsetForChild(at: index), y: 0, width: view.bounds.width, height: containerView.bounds.height) childController.view.autoresizingMask = [.flexibleHeight, .flexibleWidth] containerView.addSubview(childController.view) - childController.didMove(toParentViewController: self) + childController.didMove(toParent: self) childController.endAppearanceTransition() } } else { if childController.parent != nil { childController.beginAppearanceTransition(false, animated: false) - childController.willMove(toParentViewController: nil) + childController.willMove(toParent: nil) childController.view.removeFromSuperview() - childController.removeFromParentViewController() + childController.removeFromParent() childController.endAppearanceTransition() } } @@ -284,9 +284,9 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate { guard isViewLoaded else { return } for childController in viewControllers where childController.parent != nil { childController.beginAppearanceTransition(false, animated: false) - childController.willMove(toParentViewController: nil) + childController.willMove(toParent: nil) childController.view.removeFromSuperview() - childController.removeFromParentViewController() + childController.removeFromParent() childController.endAppearanceTransition() } reloadViewControllers() diff --git a/XLPagerTabStrip.podspec b/XLPagerTabStrip.podspec index d90c9a9..70a9d3f 100644 --- a/XLPagerTabStrip.podspec +++ b/XLPagerTabStrip.podspec @@ -12,4 +12,5 @@ Pod::Spec.new do |s| s.ios.source_files = 'Sources/**/*.{h,m,swift}' s.ios.frameworks = 'UIKit', 'Foundation' s.resource_bundles = { 'XLPagerTabStrip' => ['Sources/ButtonCell.xib'] } + s.swift_version = "4.2" end diff --git a/XLPagerTabStrip.xcodeproj/project.pbxproj b/XLPagerTabStrip.xcodeproj/project.pbxproj index 0ec5dde..9f455b3 100644 --- a/XLPagerTabStrip.xcodeproj/project.pbxproj +++ b/XLPagerTabStrip.xcodeproj/project.pbxproj @@ -458,7 +458,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -479,7 +479,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -492,7 +492,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.XLPagerTabStripTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -504,7 +504,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.XLPagerTabStripTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; From 813e74e4663be3f422e489d7150268fa90bb893c Mon Sep 17 00:00:00 2001 From: Mathias Claassen Date: Fri, 28 Sep 2018 11:32:36 -0300 Subject: [PATCH 19/19] Update xcode version in Travis config --- .travis.yml | 4 ++-- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 XLPagerTabStrip.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/.travis.yml b/.travis.yml index c15f34b..1410bab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: objective-c -osx_image: xcode9.3 +osx_image: xcode10 env: - - DESTINATION="OS=11.3,name=iPhone 8" SCHEME="XLPagerTabStrip" SDK=iphonesimulator + - DESTINATION="OS=12,name=iPhone 8" SCHEME="XLPagerTabStrip" SDK=iphonesimulator before_install: - brew update #- brew outdated carthage || brew upgrade carthage diff --git a/XLPagerTabStrip.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/XLPagerTabStrip.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/XLPagerTabStrip.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + +