see Use Case 1
see Use Case 2
Slide Up Card Controller aims to be a lightweight solution for the above use cases. For those that want a more robust solution pulley may be better suited to you
- Drag the Card folder into your project
- Set up the Card View Controller on the desired view controller
class ViewController: UIViewController {
// 1. Set instance var for the card controller
var cardViewController: CardViewController!
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// 2. Set up card after the parent VC has been layed out
if cardViewController == nil {
cardViewController = CardViewController()
cardViewController.place(on: self, percentageShownWhenExpanded: 0.7)
// 3. Optional - extend the class with CardStateNotification protocol
registerForCardStateChanges()
}
}
}
extension ViewController: CardStateNotification {
// allows the parent to access / respond to card state changes
func cardStateDidChange() {
print(cardViewController.currentCardState.rawValue)
}
}