CSSimpleSideMenu
A simple side menu for small projects.
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Screenshots
Requirements
- [x] Xcode 9.4.
- [x] Swift 4.1.
- [x] iOS 10 or higher.
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate SideMenu into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'CSSimpleSideMenu'
Then, run the following command:
$ pod install
Usage
First Step:
import CSSimpleSideMenu
Second Step:
//example
let firstViewController = UIViewController()
let secondViewController = UIViewController()
let controllers = [
SideMenuControllerModel(with: firstViewController, name: "First"),
SideMenuControllerModel(with: secondViewController, name: "Second")
]
// create customization model
let customization = SideMenuCustomizationModel()
//customize
customization.position = .left
//configure
SideMenu.configure(with: controllers, customization: customization)
Important:
You need to call (SideMenu.configure) func at start your app
SideMenu.configure(with: controllers, customization: customization)
Customization Model Properties
//----------------- Background side menu settings
// you can set just background colod
public var backgroundColor: UIColor = UIColor(red: 0.209, green: 0.251, blue: 0.311, alpha: 1)
// or background image
public var backgroundImage: UIImage? = nil
//----------------- Customize items
// background color for selected item
public var menuItemsSelectedColor: UIColor = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.1)
public var menuItemsFont: UIFont = .boldSystemFont(ofSize: 17)
public var menuItemsTitleColor: UIColor = .white
public var menuItemsHeight: CGFloat = 64
//----------------- Top and bottom images
public var topImage: UIImage? = nil
public var bottomImage: UIImage? = nil
public var imagesContentMode: UIViewContentMode = .scaleAspectFit
public var bottomImageHeight: CGFloat = 0
// top offset for menu items depends on this property
public var topImageHeight: CGFloat = UIScreen.main.bounds.height * 0.25
//----------------- Menu position
//set .left or .right side menu position
public var position: SideMenuEnums.Position = .left