MKLEGYDrawerLayout 0.2.1

MKLEGYDrawerLayout 0.2.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jul 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Madrit Kacabumi.



  • By
  • devMadrit

MKLEGYDrawerLayout

MKLEGYDrawerLayout

A Double side menu for iOS like android DrawerLayout , simple to use and customisable . Just download it and it is ready to use everything is built using panGesture recogniser;

"Click to see image"

Features

  • [x] Double side menu (left and right)
  • [x] Enable or disable one of menus (or both)
  • [x] add content (both menus) with just one line of code (constraints auto added)
  • [x] change size , colors , dim colors etc
  • [x] Movements offset

Requirements

1

Installation

MKLEGYDrawerLayout is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MKLEGYDrawerLayout"

Usagge :

  1. import library
import MKLEGYDrawerLayout

2.Declare variable (better optional)

 var sideMenu : DoubleSideMenu?

// by default menus are both enabled

3.You need to create this as a view (steps for doing it in viewdidLoad)

  1. declare bundle
// function avaible in extension in the library
let bundle = Bundle(identifier: "org.cocoapods.MKLEGYDrawerLayout")
  1. create view
// function avaible in extension in the library
sideMenu = UIView.createView(attachTo: self.view, fromBundle: bundle) 
// self.view for all the view controller container or into another view 
  1. add view into it now (create a xib or a view controller in the story board add it into the main container or side menus ( they are just views)
   I   sideMenu?.setMainContentView (view : UIView, animated : Bool = false)
   //no need to add constraints , they are automatically added
   II   sideMenu?.addLeftMenu(view : UIView, animated: Bool = false) 
   III    sideMenu?.addRightMenu(view : UIView, animated: Bool = false)
  1. ENJOY !

Customisation :

  1. width by default is 280 , but you can change it for both of them
  sideMenu?.setLeftMenuWidth(width : CGFloat)
  sideMenu?.setRightMenuWidth(width : CGFloat)
  // do not use negative values as the will go back to default : 280
  1. every time you open one of menus lets suppose the left one , the Main Cointainer will have a black color with alpha 0.3 (Dim), to change the color simply
sideMenu?.setMenuDimColor(colorHexString : "#BBBBBB")
  1. if you need to disable any menu or if any is disabled and you want to enable (by default are both enabled) simply
    sideMenu?.disableRightMenu()
    sideMenu?.disableLeftMenu()
    // OR
    sideMenu?.enableRightMenu()
    sideMenu?.enableLeftMenu()
  1. if during app running you need to change content then
   sideMenu?.clearLeftMenu()
    //OR  

    sideMenu?. clearRightMenu() 
    //OR 
    // both of them :D   and anything else again
  1. if you need to open or close programatically menus then
  sideMenu?.closeAllMenus()
  sideMenu?.closeRightSideMenu()
  sideMenu?.closeLeftSideMenu()

  -- to open them --

  sideMenu?.openLeftSideMenu()
  sideMenu?.openRightSideMenu()
  1. additional data only for check , NOTE : use only for direct check NOT changing !!
   sideMenu?.leftSideBarIsOpen : Bool
   sideMenu?.rightSideBarIsOpen : Bool

   sideMenu?.leftMenuIsEnabled : Bool
   sideMenu?.rightMenuIsEnabled : Bool

Author

Madrit Kacabumi (Mobile Developer), [email protected] or [email protected]

License

MKLEGYDrawerLayout is available under the GPL license , free for everyone to use :)