To run the example project, clone the repo, and run pod install
from the Example directory first.
For enjoy this framework you have three simple steps:
Let's import SwiftyTabBarTransition in top of your UITabBarController
class first
import SwiftyTabBarTransition
then in viewDidLoad()
method of your UITabBarController
, make delegate
equal to self
, pretty simple so far, right?! ๐
class TabBarController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
delegate = self
}
}
your UITabBarController
class, must inherite from UITabBarControllerDelegate
protocol, so write an extension of your UITabBarController
, then confirm from animationControllerForTransitionFrom
method
extension TabBarController: UITabBarControllerDelegate {
func tabBarController(_ tabBarController: UITabBarController, animationControllerForTransitionFrom fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
let transitionOptions = SwiftyTabBarTransitionOptions(duration: 0.3, animationOption: .bottomToTop)
let transition = SwiftyTabBarTransition.set(transition: transitionOptions)
return transition
}
}
Create an object of SwiftyTabBarTransitionOptions
. This class has 2 peroperties:
- duration
Which is the duration of transition
- animationOption
Which is the style of transition animation
It's an enum
for changing transition animation
animationOption |
---|
.scaleX |
.scaleY |
.scaleInXY |
.scaleOutXY |
.rightToLeft |
.leftToRight |
.topToBottom |
.bottomToTop |
.fade |
.topLeftToBottomRight |
.bottomLeftToTopRight |
iOS 9.3+
Xcode 10.2.1
Swift 5
SwiftyTabBarTransition is available through CocoaPods. To install it in latest version, simply add the following line to your Podfile:
pod 'SwiftyTabBarTransition', '~> 1.0.2'
pod 'SwiftyTabBarTransition', '~> 1.5.3'
To get the latest version of library using Carthage, you can add following line to your Cartfile.
github "shndrs/SwiftyTabBarTransition" "1.0.2"
github "shndrs/SwiftyTabBarTransition" "1.5.3"
[email protected], [email protected], shndrs
SwiftyTabBarTransition is available under the MIT license. See the LICENSE file for more info.