Giter VIP home page Giter VIP logo

airdrawermenuviewcontroller's Introduction

AirDrawerMenuViewController

legendary airbnb drawer menu in swift

Demo

alt tag

Install

Manual

Copy & paste AirDrawerMenuViewController folder into your project.

Cocoapods
	pod 'AirDrawerMenuViewController', '~> 0.1'

Usage

Create a subclass of AirDrawerMenuViewController and implement its AirDrawerMenuViewControllerDataSource.

    
protocol AirDrawerMenuViewControllerDataSource {
    
    func airDrawerMenuViewControllerNumberOfViewControllersInContentView (airDrawerMenuViewController: AirDrawerMenuViewController) -> Int
    func airDrawerMenuViewControllerViewControllerAtIndex (airDrawerMenuViewController: AirDrawerMenuViewController, index: Int) -> UIViewController

}
    

In viewDidLoad method, assign its leftMenuViewController and set its dataSource as self.

    override func viewDidLoad() {
        super.viewDidLoad()
        
        for i in 0...3 {
            containerViewControllers.append(vc ("\(i) vc"))
        }
        
        leftMenuViewController = UIStoryboard (name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("LeftMenuViewController") as! LeftMenuViewController
        dataSource = self
    }

In viewDidAppear: method, call reloadDrawer().

    override func viewDidAppear(animated: Bool) {
        reloadDrawer()
    }    

The Drawer

UIViewController's has airDrawerMenu property. You can call self.airDrawerMenu.openMenu() and self.airDrawerMenu.closeMenu() for opening and closing drawer.

Also you can write custom animations for your AirDrawerMenuLeftViewController.

AirDrawerMenuLeftViewController

It's an abstract class with its protocol methods.

protocol AirDrawerMenuLeftViewControllerDelegate {
    
    func reloadLeftMenu ()
    func openLeftMenuAnimation (completion: (() -> Void)?)
    func closeLeftMenuAnimation (completion: (() -> Void)?)
    
}

class AirDrawerMenuLeftViewController: UIViewController, AirDrawerMenuLeftViewControllerDelegate {

    
    // �MARK: AirDrawerMenuLeftViewControllerDelegate
    // Override these methods in your subclass

    func reloadLeftMenu() {
        
    }
    
    func openLeftMenuAnimation(completion: (() -> Void)?) {
        
    }
    
    func closeLeftMenuAnimation(completion: (() -> Void)?) {
        
    }
}

You can sublass it and write you own opening & closing animations for left menu. Also you can notify your left menu when AirMenuDrawerViewController reloads itself.

airdrawermenuviewcontroller's People

Contributors

cemolcay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

denikaev

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.