Convert Figma logo to code with AI

evnaz logoENSwiftSideMenu

A simple side menu for iOS written in Swift.

1,819
282
1,819
92

Top Related Projects

iOS 7/8 style side menu with parallax effect.

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

Animated side menu with customizable UI

A side menu controller written in Swift for iOS

Quick Overview

ENSwiftSideMenu is a lightweight and easy-to-use side menu control for iOS applications written in Swift. It provides a customizable sliding menu that can be integrated into iOS apps to enhance navigation and user experience.

Pros

  • Simple and lightweight implementation
  • Customizable appearance and behavior
  • Supports both left and right side menus
  • Easy integration with existing iOS projects

Cons

  • Limited advanced features compared to some other side menu libraries
  • May require additional customization for complex use cases
  • Documentation could be more comprehensive
  • Not actively maintained (last update was several years ago)

Code Examples

  1. Initialize and present the side menu:
let menuViewController = MenuViewController()
let sideMenu = ENSideMenu(sourceView: self.view, menuViewController: menuViewController, menuPosition: .left)
sideMenu.delegate = self
self.sideMenu = sideMenu
self.view.addSubview(sideMenu)
  1. Toggle the side menu:
@IBAction func toggleSideMenu(_ sender: Any) {
    sideMenu?.toggleMenu()
}
  1. Implement delegate methods:
extension ViewController: ENSideMenuDelegate {
    func sideMenuWillOpen() {
        print("Side menu will open")
    }
    
    func sideMenuWillClose() {
        print("Side menu will close")
    }
}

Getting Started

  1. Add ENSwiftSideMenu to your project:

    • CocoaPods: Add pod 'ENSwiftSideMenu' to your Podfile
    • Manual: Copy the ENSwiftSideMenu folder to your project
  2. Import the module in your view controller:

    import ENSwiftSideMenu
    
  3. Initialize and add the side menu to your view:

    let menuViewController = MenuViewController()
    let sideMenu = ENSideMenu(sourceView: self.view, menuViewController: menuViewController, menuPosition: .left)
    self.sideMenu = sideMenu
    self.view.addSubview(sideMenu)
    
  4. Customize the appearance and behavior as needed:

    sideMenu.menuWidth = 280
    sideMenu.bouncingEnabled = true
    
  5. Implement the ENSideMenuDelegate methods to handle menu events if required.

Competitor Comparisons

iOS 7/8 style side menu with parallax effect.

Pros of RESideMenu

  • Written in Objective-C, which may be preferred by some developers
  • Supports both left and right side menus
  • Includes built-in animations and customization options

Cons of RESideMenu

  • Less modern than Swift-based alternatives
  • May require more setup and configuration
  • Limited integration with newer iOS features and APIs

Code Comparison

ENSwiftSideMenu:

let menuViewController = UIViewController()
let sideMenu = ENSideMenu(sourceView: self.view, menuViewController: menuViewController, menuPosition: .Left)
sideMenu.delegate = self

RESideMenu:

RESideMenu *sideMenu = [[RESideMenu alloc] initWithContentViewController:contentViewController
                                                    leftMenuViewController:leftMenuViewController
                                                   rightMenuViewController:rightMenuViewController];
self.window.rootViewController = sideMenu;

Summary

RESideMenu offers a more established Objective-C solution with built-in animations and customization options. However, ENSwiftSideMenu provides a modern Swift implementation that may be easier to integrate with newer iOS projects. The choice between the two depends on the developer's preference for language and specific project requirements.

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

Pros of SlideMenuControllerSwift

  • More customizable with options for left and right side menus
  • Supports both storyboard and programmatic implementation
  • Includes gesture recognizers for smoother user interaction

Cons of SlideMenuControllerSwift

  • Slightly more complex setup process
  • May have a steeper learning curve for beginners
  • Requires more configuration to achieve a simple side menu

Code Comparison

ENSwiftSideMenu:

let menuViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MenuViewController")
let sideMenu = ENSideMenu(sourceView: self.view, menuViewController: menuViewController, menuPosition: .left)
sideMenu.delegate = self

SlideMenuControllerSwift:

let mainViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MainViewController")
let leftViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "LeftViewController")
let slideMenuController = SlideMenuController(mainViewController: mainViewController, leftMenuViewController: leftViewController)
self.window?.rootViewController = slideMenuController

Both libraries offer side menu functionality for Swift applications, but SlideMenuControllerSwift provides more advanced features and customization options. ENSwiftSideMenu is simpler to implement and may be preferable for basic side menu needs. The code comparison shows that SlideMenuControllerSwift requires more setup but offers greater flexibility in menu positioning and configuration.

Animated side menu with customizable UI

Pros of Side-Menu.iOS

  • More visually appealing with customizable animations
  • Actively maintained with recent updates
  • Comprehensive documentation and example project

Cons of Side-Menu.iOS

  • Larger codebase, potentially more complex to implement
  • Heavier resource usage due to animations
  • May require more setup time compared to simpler alternatives

Code Comparison

ENSwiftSideMenu:

let menuViewController = UIViewController()
let sideMenu = ENSideMenu(sourceView: self.view, menuViewController: menuViewController, menuPosition: .Left)
sideMenu.delegate = self

Side-Menu.iOS:

let menuViewController = YALSideMenuViewController()
let sideMenuManager = YALSideMenuManager(sideMenuViewController: menuViewController)
sideMenuManager.addPanGestureToPresent(toView: self.navigationController!.navigationBar)
sideMenuManager.addScreenEdgePanGesturesToPresent(toView: self.navigationController!.view)

Both libraries offer side menu functionality, but Side-Menu.iOS provides more advanced features and customization options. ENSwiftSideMenu is simpler and easier to implement, while Side-Menu.iOS offers a more polished user experience with animations. The code comparison shows that Side-Menu.iOS requires more setup but provides additional gesture recognizers for menu interaction.

A side menu controller written in Swift for iOS

Pros of SideMenuController

  • More customizable with various configuration options
  • Supports both left and right side menus
  • Smoother animations and transitions

Cons of SideMenuController

  • Slightly more complex setup process
  • Requires more code to implement basic functionality
  • May have a steeper learning curve for beginners

Code Comparison

SideMenuController:

let sideMenuController = SideMenuController()
sideMenuController.leftViewController = leftViewController
sideMenuController.centerViewController = centerViewController
sideMenuController.rightViewController = rightViewController

ENSwiftSideMenu:

let sideMenu = ENSideMenu(sourceView: self.view, menuViewController: menuViewController, menuPosition: .Left)
sideMenu.delegate = self
self.sideMenu = sideMenu

SideMenuController offers more flexibility in terms of menu positioning and configuration, while ENSwiftSideMenu provides a simpler implementation for basic side menu functionality. SideMenuController requires more setup code but allows for greater customization, whereas ENSwiftSideMenu has a more straightforward approach with fewer lines of code needed for basic implementation.

Both libraries serve the purpose of creating side menus in iOS applications, but SideMenuController is better suited for projects requiring advanced customization and multiple menu options, while ENSwiftSideMenu is ideal for simpler implementations with minimal setup.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

ENSwiftSideMenu

A lightweight flyover side menu component for iOS with the UIDynamic's bouncing animation, UIGestures and UIBlurEffect. Allows you to use native UINavigationController's logic to manage view controllers. The component is written in Swift.

Requirements

  • iOS 9 or higher

Installation

CocoaPods

The recommended way for installating ENSwiftSideMenu is via the CocoaPods package manager

platform :ios, '9.0'
pod 'ENSwiftSideMenu', '~> 0.1.4'

Manual Install

All you need is import ENSideMenu.swift and ENSideMenuNavigationController.swift to your project folder.

Usage Example

  1. Create a root UINavigationController subclassing from ENSideMenuNavigationController
  2. Create a UIViewController for your side menu
  3. Initilize the menu view with a source view and menu view controller:
override func viewDidLoad() {
  super.viewDidLoad()
  sideMenu = ENSideMenu(sourceView: self.view, menuViewController: MyMenuViewController(), menuPosition:.Left)
  // show the navigation bar over the side menu view
  view.bringSubviewToFront(navigationBar)
}
  1. To change content view controller use next line in your menu view controller:
sideMenuController()?.setContentViewController(destViewController)
  1. Check example project for more explanation

License

The MIT License (MIT)

Copyright (c) 2014 Evgeny Nazarov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.