Hamburger Menu using Swift and iOS 8 API's

Related tags

Menu FrostedSidebar
Overview

FrostedSidebar

Hamburger Menu using Swift and iOS 8 API's

Heavily influenced by @_ryannystrom's RNFrostedSidebar

This implementation uses iOS 8's new UIVisualEffectView to apply the blur to the sidebar. Among other changes, this sidebar has a view that dims the background to shift the focus to the presented content.

The buttons have the same ring effect on click. The buttons are more customizable as I will go into later.

##Usage##

In the example project, the sidebar is added quite easily.

Create a property in your UIViewController subclass.

var frostedSidebar: FrostedSidebar = FrostedSidebar(images: imageArray, colors: colorArray, selectionStyle: chosenSelectionStyle)

where images contains the icons for the buttons, colors contains the border colors for the icons, and selectionStyle is the sidebar items' selection behavior (either .None, .Single, or .All).

The colors parameter is optional, and can either be nil or be the same length as images.

The buttons can be set to use a closure when tapped using

frostedSidebar.actionForIndex[idx] = { /* actions */ }

To show the sidebar, use the following code in your view controller:

frostedSidebar.showInViewController( self, animated: true )

It can be dismissed in a similar way:

frostedSidebar.dismissAnimated(true, completion: nil)

The class that conforms to the FrostedSidebarDelegate must implement the following methods:

func sidebar(sidebar: FrostedSidebar, willShowOnScreenAnimated animated: Bool)
func sidebar(sidebar: FrostedSidebar, didShowOnScreenAnimated animated: Bool)
func sidebar(sidebar: FrostedSidebar, willDismissFromScreenAnimated animated: Bool)
func sidebar(sidebar: FrostedSidebar, didDismissFromScreenAnimated animated: Bool)
func sidebar(sidebar: FrostedSidebar, didTapItemAtIndex index: Int)
func sidebar(sidebar: FrostedSidebar, didEnable itemEnabled: Bool, itemAtIndex index: Int)

Installation

CocoaPods

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

platform :ios, '8.0'
use_frameworks!
pod 'FrostedSidebar'

To get the full benefits import FrostedSidebar wherever you import UIKit

import UIKit
import FrostedSidebar

Manually

  1. Download and drop FrostedSidebar.swift in your project.
  2. Congratulations!

##Conclusion##

This would not be possible without the impressive work by Ryan Nystrom, and the great design by Jakub Antalík on Dribbble.

Hopefully someone finds this useful!

Comments
  • Loading programmatically the tab > 3

    Loading programmatically the tab > 3

    Great job ! I will use in my future app.

    func sidebar(sidebar: FrostedSidebar, didTapItemAtIndex index: Int) work for index > 3 but self.selectedIndex work only for index 0...3

    How to load the next tab (4, 5, 6) programmatically when the app is loaded ?

    opened by phemka 6
  • Sidebar behind NavigationBar

    Sidebar behind NavigationBar

    Is it on purpose that the sidebar appears behind the Navigationbar if the ViewController is embedded inside a NavigationController?

    It "destroys" the UI. :-/

    screen shot 2015-11-29 at 20 00 52
    opened by ciso 4
  • Can't get buttons to work

    Can't get buttons to work

    What a fantastic sidebar menu!

    I added the swift file in my project; I added the script: var frostedSidebar: FrostedSidebar = FrostedSidebar(images: imageArray, colors: colorArray, selectionStyle: chosenSelectionStyle) And changed the right things;

    I added the following script to a button function: frostedSidebar.showInViewController( self, animated: true )

    And al of this works perfect! The sidebar is showing and the animations works fine.

    But i just can get the button action inside the sidebar to work. I don't have a tabbar in my project. I do have 3 viewcontrollers and added a navigation controller. I know how to use segues.

    Can you tell me how to get respons from the sidebar buttons? I don't know how and where to use the given script: frostedSidebar.actionForIndex[idx] = { /* actions */ }

    opened by ghost 4
  • convertFromNilLiteral()

    convertFromNilLiteral()

    Hi , I have downloaded the project and when I open the app I get this issue "doesnt not have a member named convertFromNilLiteral()" .

    UIViewAnimationOptions.convertFromNilLiteral()

    What can I do to resolve this ?

    Thank you .

    Marc

    opened by marcandree 2
  • Won't init at runtime. Installation issue?

    Won't init at runtime. Installation issue?

    I am trying this out on a little project that I have. I added the TabBarController.swift and the FrostedSidebar.swift files to my app. In story board I added a TabBarController and made TabBarController.swift its object. Then I made this the startup view.

    I run the app, but it never actually calls the FrostedSideBar init in TabBarController.

    sidebar = FrostedSidebar(itemImages: [ UIImage(named: "gear")!, UIImage(named: "globe")!, UIImage(named: "profile")!, UIImage(named: "profile")!, UIImage(named: "profile")!, UIImage(named: "profile")!, UIImage(named: "star")!], colors: [ UIColor(red: 240/255, green: 159/255, blue: 254/255, alpha: 1), UIColor(red: 255/255, green: 137/255, blue: 167/255, alpha: 1), UIColor(red: 126/255, green: 242/255, blue: 195/255, alpha: 1), UIColor(red: 126/255, green: 242/255, blue: 195/255, alpha: 1), UIColor(red: 126/255, green: 242/255, blue: 195/255, alpha: 1), UIColor(red: 126/255, green: 242/255, blue: 195/255, alpha: 1), UIColor(red: 119/255, green: 152/255, blue: 255/255, alpha: 1)], selectedItemIndices: NSIndexSet(index: 0))

    It seems to skip over the initializer.

    Did I install it wrong?

    opened by jimijon 1
  • How to add web view?

    How to add web view?

    Hi, i would like to add a web view to the view controller 2 so when the user presses the 'globe' icon it takes them to a web page. I added a web view and connected it to ViewController.swift and then loaded a url with url requests. Unfortunately i get an exception error when I run the program... Any ideas??

    Thanks so much for this amazing sidebar demo app!!

    opened by ksuchar 1
  • Installation section

    Installation section

    Hey, your library is really interesting.

    The only problem I found was the README.md, which lacks an Installation Section I created this iOS Open source Readme Template so you can take a look on how to easily create an Installation Section If you want, I can help you to organize the lib.

    What are your thoughts? 😄

    opened by lfarah 0
  • Check if sidebar is open

    Check if sidebar is open

    This pull request adds a variable to the class that updates when the sidebar opens and closes. This allows for checking inside your button method to see whether you should open or close the sidebar.

    opened by jdmcd 0
  • fix the build error in Xcode 6

    fix the build error in Xcode 6

    fix the build error in Xcode 6

    error: could not read data from '.../FrostedSidebar/CustomStuffTests/Info.plist': The file “Info.plist” couldn’t be opened because there is no such file.

    opened by NilStack 0
  • build error in Xcode 6

    build error in Xcode 6

    build error in Xcode 6

    error: could not read data from '.../FrostedSidebar/CustomStuffTests/Info.plist': The file “Info.plist” couldn’t be opened because there is no such file.

    opened by NilStack 0
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 0
Releases(1.0.0)
Owner
Evan Dekhayser
Evan Dekhayser
Swift-sidebar-menu-example - Create amazing sidebar menu with animation using swift

 SWIFT SIDEBAR MENU EXAMPLE In this project I create a awesome side bar menu fo

Paolo Prodossimo Lopes 4 Jul 25, 2022
SwiftySideMenu is a lightweight and easy to use side menu controller to add left menu and center view controllers with scale animation based on Pop framework.

SwiftySideMenu SwiftySideMenu is a lightweight, fully customizable, and easy to use controller to add left menu and center view controllers with scale

Hossam Ghareeb 84 Feb 4, 2022
A Slide Menu, written in Swift, inspired by Slide Menu Material Design

Swift-Slide-Menu (Material Design Inspired) A Slide Menu, written in Swift 2, inspired by Navigation Drawer on Material Design (inspired by Google Mat

Boisney Philippe 90 Oct 17, 2020
Slide-Menu - A Simple Slide Menu With Swift

Slide Menu!! Весь интерфейс создан через код

Kirill 0 Jan 8, 2022
EasyMenu - SwiftUI Menu but not only button (similar to the native Menu)

EasyMenu SwiftUI Menu but not only button (similar to the native Menu) You can c

null 10 Oct 7, 2022
A menu bar app to change input source swiftly using shortcuts on macOS Big Sur or later.

Source Switcher A menu bar app to change input sources swiftly using shortcuts on macOS Big Sur and later. View screenshots Introduction This app uses

null 34 Nov 9, 2022
This is a simple Mac Catalyst example showcasing how to build a dropdown menu toolbar button using AppKit.

CatalystToolbarMenuButton This is a simple Mac Catalyst example showcasing how to build a dropdown menu toolbar button using AppKit. There are ways to

Steven Troughton-Smith 24 Dec 8, 2022
iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

SlideMenuControllerSwift iOS Slide View based on iQON, Feedly, Google+, Ameba iPhone app. Installation CocoaPods pod 'SlideMenuControllerSwift' Carth

Yuji Hato 3.3k Dec 29, 2022
Swipable tab and menu View and ViewController.

SwipeMenuViewController Overview SwipeMenuViewController provides SwipeMenuView and SwipeMenuViewController. This is very useful to build swipe-based

Yusuke Morishita 1.2k Dec 29, 2022
Grid and Circular Menu for iOS.

IGCMenu IGCMenu library gives easy way to create Grid and Circular menu in app. This is light weight and highly customisable menu.Support iOS 7 and ab

Sunil Sharma 138 Nov 14, 2022
An iOS drop down menu with pretty animation and easy to customize.

IGLDropDownMenu An iOS drop down menu with pretty animation. Screenshot How To Use Use CocoaPods: pod 'IGLDropDownMenu' Manual Install: Just drap the

Galvin Li 1.2k Dec 27, 2022
Simple and Elegant Drop down menu for iOS 🔥💥

SwiftyMenu is simple yet powerfull drop down menu component for iOS. It allow you to have drop down menu that doesn't appear over your views, which gi

Karim Ebrahem 502 Nov 29, 2022
⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion

CIRCLE MENU Simple, elegant UI menu with a circular layout and material design animations We specialize in the designing and coding of custom UI for M

Ramotion 3.4k Dec 29, 2022
UIKit drop down menu, simple yet flexible and written in Swift

DropDownMenuKit DropDownMenuKit is a custom UIKit control to show a menu attached to the navigation bar or toolbar. The menu appears with a sliding an

Quentin Mathé 258 Dec 27, 2022
Menu controller with expandable item groups, custom position and appearance animation written with Swift. Similar to ActionSheet style of UIAlertController.

Easy to implement controller with expanding menu items. Design is very similar to iOS native ActionSheet presentation style of a UIAlertController. As

Anatoliy Voropay 22 Dec 27, 2022
A simple side menu for iOS written in Swift.

ENSwiftSideMenu A lightweight flyover side menu component for iOS with the UIDynamic's bouncing animation, UIGestures and UIBlurEffect. Allows you to

Evgeny Nazarov 1.8k Dec 21, 2022
iOS Interactive Side Menu written in Swift.

Interactive Side Menu A customizable, interactive, auto expanding and collapsing side menu for iOS written in Swift. Here are some of the ways Interac

Handsome 706 Dec 15, 2022
✨ Awesome Dropdown menu for iOS with Swift 5.0

The eligible dropdown menu for iOS, written in Swift 5, appears dropdown menu to display a view of related items when a user click on the dropdown menu. You can customize dropdown view whatever you like (e.g. UITableView, UICollectionView... etc)

Kyle Yi 1.3k Dec 26, 2022
RadialMenu is a custom control for providing a touch context menu (like iMessage recording in iOS 8) built with Swift & POP

RadialMenu Looking for help? For $150/hr I'll help with your RadialMenu problems including integrating it into your project. Email [email protected] t

Brad Jasper 297 Nov 27, 2022