Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/SimformSolutionsPvtLtd/SSCustomSideMenu

Side Menu Custom Control for iOS apps
https://github.com/SimformSolutionsPvtLtd/SSCustomSideMenu

cocoapod ios ios13 sidemenu swift swift5 xcode11

Last synced: about 1 month ago
JSON representation

Side Menu Custom Control for iOS apps

Awesome Lists containing this project

README

        

# SSCustomSideMenu

[![Version](https://img.shields.io/cocoapods/v/SSCustomSideMenu.svg?style=flat)](https://cocoapods.org/pods/SSCustomSideMenu)
[![License](https://img.shields.io/cocoapods/l/SSCustomSideMenu.svg?style=flat)](https://cocoapods.org/pods/SSCustomSideMenu)
[![Platform](https://img.shields.io/cocoapods/p/SSCustomSideMenu.svg?style=flat)](https://cocoapods.org/pods/SSCustomSideMenu)

![Alt text](http://files.simformsolutions.com.s3.amazonaws.com/simformscreen/screencast_2020-05-06_18-39-40.gif)
![Alt text](http://files.simformsolutions.com.s3.amazonaws.com/simformscreen/screencast_2020-05-06_18-42-41.gif)
![Alt text](http://files.simformsolutions.com.s3.amazonaws.com/simformscreen/screencast_2020-05-06_18-52-40.gif)
![Alt text](http://files.simformsolutions.com.s3.amazonaws.com/simformscreen/screencast_2020-05-06_18-59-57.gif)

## Features
- Highly customizable
- Multiple options of animations
- Dynamic menu size
- Available through CocoaPods

## Requirements
- iOS 11.0+
- Xcode 10+

## Installation
**CocoaPods**

- You can use CocoaPods to install SSCustomSideMenu by adding it to your Podfile:

use_frameworks!
pod 'SSCustomSideMenu'

- In the swift file, import SSSideMenu module:

import UIKit
import SSCustomSideMenu

**Manually**
- Download and drop **SSCustomSideMenu** folder in your project.
- Congratulations!

## Usage example

**Create a subclass of SSSideMenuContainerViewController**

class SideMenuViewController: SSSideMenuContainerViewController { ... }

- In the storyboard assign a custom class **SideMenuViewController** you just created to a viewController. This viewController will be the container for Side menu.
![Alt text](http://files.simformsolutions.com.s3.amazonaws.com/simformscreen/Main.storyboard_2020-04-23_10-22-17.png)

**Create Menu Table**

let menuTable = SSMenuTableView()


**Configure Side Menu Options**

let menuCellConfig = SSMenuCellConfig()

menuCellConfig.cellStyle = .defaultStyle

menuCellConfig.leftIconPadding = 20
menuCellConfig.imageToTitlePadding = 10
menuCellConfig.imageHeight = 24
menuCellConfig.imageWidth = 24

menuCellConfig.numberOfOptions = 3

menuCellConfig.selectedColor = .purple
menuCellConfig.nonSelectedColor = .black

menuCellConfig.images = [UIImage(named: "first"), UIImage(named: "second"), UIImage(named: "third")]
menuCellConfig.titles = ["First", "Second", "Thrird"]

self.menuTable.config = menuCellConfig


**Configure Side Menu**

let sideMenuConfig = SSSideMenuConfig()
sideMenuConfig.animationType = .slideOut // Other options: .slideIn, .compress(0.8, 20)
sideMenuConfig.sideMenuPlacement = .left // Other options: .right
sideMenuConfig.menuWidth = UIScreen.main.bounds.width * 0.5

let firstViewController = storyboard?.instantiateViewController(withIdentifier: "FirstViewController")
let secondViewController = storyboard?.instantiateViewController(withIdentifier: "SecondViewController")
let thirdViewController = storyboard?.instantiateViewController(withIdentifier: "ThirdViewController")

sideMenuConfig.viewControllers = [firstViewController!, secondViewController!, thirdViewController!]

sideMenuConfig.menuTable = menuTable

self.ssMenuConfig = sideMenuConfig


**Delegates**

- SSCustomSideMenu provides delegate 'sideMenuDelegate' which lets developers dynamically decide which operations to perform on menu option selection

sideMenuDelegate = self

- By doing this, you will be asked to confirm to following protocol:

extension ViewController: SSSideMenuDelegate {
func shouldOpenViewController(forMenuOption menuOption: Int) -> Bool {
if menuOption == 1 {
// Perform action for custom options (i.e logout)
return false
} else {
return true
}
}
}

**Open and Close Side Menu**

- SSCustomSideMenu Provides custom side menu button - 'SSMenuButton'.
You only need to assign SSMenuButton custom class to your UIButton from Interface Builder

- Manually open or close side menu :

SSSideMenuControls.openOrCloseSideMenu()

# Contribute
- We would love you for the contribution to SSCustomSideMenu, check the LICENSE file for more info.

# License

- SSCustomSideMenu is available under the MIT license. See the LICENSE file for more info.

[![License](https://img.shields.io/cocoapods/l/SSCustomSideMenu.svg?style=flat)](https://cocoapods.org/pods/SSCustomSideMenu)
[![Platform](https://img.shields.io/cocoapods/p/SSCustomSideMenu.svg?style=flat)](https://cocoapods.org/pods/SSCustomSideMenu)