To run the example project, clone the repo, and run pod install
from the Example directory first.
- iOS 10.0+
- Swift 5
CardTransition is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'CardStyleTransition'
You only need to set your custom transition handler and conform to BottomOverlayprotocol.
class SecondViewController: UIViewController, BottomOverlayProtocol {
var transitionHandler : BottomOverlayTransitionHandler!
init() {
super.init(nibName: nil, bundle: nil)
self.transitionHandler = BottomOverlayTransitionHandler(presented: self,
interactive: true,
dimmedColor: .blue,
indicatorColor: .yellow,
duration: 1)
transitioningDelegate = transitionHandler
modalPresentationStyle = .custom
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .red
}
func bottomOverlayHeight() -> CGFloat {
return 300
}
func bottomOverlayWidth() -> CGFloat {
return min(UIScreen.main.bounds.width, 414 )
}
}
By implementing bottomOverlayHeight()
you can specify the height of the overlay. If you dont implement this method it will apply the minimum height that fits to the container
CardStyleTransition is available under the MIT license. See the LICENSE file for more info.