Skip to content

mickspecial/Card-Slideover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slide Up Card Controller

Purpose

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


Usage

  1. Drag the Card folder into your project
  2. 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)
  }
}

Preview

preview


Enjoy

About

Slide up view for iOS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages