A Swift implementation of RESideMenu

Overview

SSASideMenu

SSASideMenu is a reimplementation of romaonthego/RESideMenu in Swift. A iOS 7/8 style side menu with parallax effect.

###Usage

      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

      window = UIWindow(frame: UIScreen.main.bounds)

        //MARK : Setup SSASideMenu

        let sideMenu = SSASideMenu(contentViewController: UINavigationController(rootViewController: FirstViewController()), leftMenuViewController: LeftMenuViewController(), rightMenuViewController: RightMenuViewController())
        sideMenu.backgroundImage = UIImage(named: "Background.jpg")
        sideMenu.configure(SSASideMenu.MenuViewEffect(fade: true, scale: true, scaleBackground: false))
        sideMenu.configure(SSASideMenu.ContentViewEffect(alpha: 1.0, scale: 0.7))
        sideMenu.configure(SSASideMenu.ContentViewShadow(enabled: true, color: UIColor.black, opacity: 0.6, radius: 6.0))
        sideMenu.delegate = self

        window?.rootViewController = sideMenu
        window?.makeKeyAndVisible()

        return true
    }

###Installation As for now please clone the repository and drag the source folder into your project to use SSASideMenu. (Cocoapods & Carthage support coming soon) ###Customization

    enum SSASideMenuPanDirection: Int {
        case edge = 0
        case everyWhere = 1
    }

    enum SSASideMenuType: Int {
        case scale = 0
        case slip = 1
    }

    enum SSAStatusBarStyle: Int {
        case hidden = 0
        case black = 1
        case light = 2
    }


    struct ContentViewShadow {

        var enabled: Bool = true
        var color: UIColor = UIColor.black
        var offset: CGSize = CGSize.zero
        var opacity: Float = 0.4
        var radius: Float = 8.0

    }

    struct MenuViewEffect {

        var fade: Bool = true
        var scale: Bool = true
        var scaleBackground: Bool = true
        var parallaxEnabled: Bool = true
        var bouncesHorizontally: Bool = true
        var statusBarStyle: SSAStatusBarStyle = .black
    }

    struct ContentViewEffect {

        var alpha: Float = 1.0
        var scale: Float = 0.7
        var landscapeOffsetX: Float = 30
        var portraitOffsetX: Float = 30
        var minParallaxContentRelativeValue: Float = -25.0
        var maxParallaxContentRelativeValue: Float = 25.0
        var interactivePopGestureRecognizerEnabled: Bool = true
    }

    struct SideMenuOptions {

        var animationDuration: Float = 0.35
        var panGestureEnabled: Bool = true
        var panDirection: SSASideMenuPanDirection = .edge
        var type: SSASideMenuType = .scale
        var panMinimumOpenThreshold: UInt = 60
        var menuViewControllerTransformation: CGAffineTransform = CGAffineTransform.init(scaleX: 1.5, y: 1.5)
        var backgroundTransformation: CGAffineTransform = CGAffineTransform.init(scaleX: 1.7, y: 1.7)
        var endAllEditing: Bool = false
    }


    // MARK : Storyboard Support
    @IBInspectable var contentViewStoryboardID: String?
    @IBInspectable var leftMenuViewStoryboardID: String?
    @IBInspectable var rightMenuViewStoryboardID: String?

    // MARK : Private Properties: MenuView & BackgroundImageView
    @IBInspectable var fadeMenuView: Bool =  true
    @IBInspectable var scaleMenuView: Bool = true
    @IBInspectable var scaleBackgroundImageView: Bool = true
    @IBInspectable var parallaxEnabled: Bool = false
    @IBInspectable var bouncesHorizontally: Bool = true

    // MARK : Public Properties: MenuView
    @IBInspectable var statusBarStyle: SSAStatusBarStyle = .black

    // MARK : Private Properties: ContentView
    @IBInspectable var contentViewScaleValue: Float = 0.7
    @IBInspectable var contentViewFadeOutAlpha: Float = 1.0
    @IBInspectable var contentViewInLandscapeOffsetCenterX: Float = 30.0
    @IBInspectable var contentViewInPortraitOffsetCenterX: Float = 30.0
    @IBInspectable var parallaxContentMinimumRelativeValue: Float = -25.0
    @IBInspectable var parallaxContentMaximumRelativeValue: Float = 25.0

    // MARK : Public Properties: ContentView
    @IBInspectable var interactivePopGestureRecognizerEnabled: Bool = true
    @IBInspectable var endAllEditing: Bool = false

    // MARK : Private Properties: Shadow for ContentView
    @IBInspectable var contentViewShadowEnabled: Bool = true
    @IBInspectable var contentViewShadowColor: UIColor = UIColor.black
    @IBInspectable var contentViewShadowOffset: CGSize = CGSize.zero
    @IBInspectable var contentViewShadowOpacity: Float = 0.4
    @IBInspectable var contentViewShadowRadius: Float = 8.0

    // MARK : Public Properties: SideMenu
    @IBInspectable var animationDuration: Float = 0.35
    @IBInspectable var panGestureEnabled: Bool = true
    @IBInspectable var panDirection: SSASideMenuPanDirection = .edge
    @IBInspectable var type: SSASideMenuType = .scale
    @IBInspectable var panMinimumOpenThreshold: UInt = 60
    @IBInspectable var menuViewControllerTransformation: CGAffineTransform = CGAffineTransform(scaleX: 1.5, y:1.5)
    @IBInspectable var backgroundTransformation: CGAffineTransform = CGAffineTransform(scaleX: 1.7, y:1.7)

    // MARK : Public Properties
    weak var delegate: SSASideMenuDelegate?
    var backgroundImage: UIImage?
    var contentViewController: UIViewController?
    var leftMenuViewController: UIViewController?
    var rightMenuViewController: UIViewController?

###Author

Sebastian Andersen

romaonthego/RESideMenu was authored by Roman Efimov

###License

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

Comments
  • Elements of called view always nil

    Elements of called view always nil

    When i put it in my project, with storyboard, i did everything like in the example, but if i instantiate, for example, a collectionviewcontroller, the collection view is always nil. It looks like the istantiated view always has no child elements..

    opened by MauMaxxa 7
  • unwanted area between menu and content

    unwanted area between menu and content

    Hi,

    we've discovered a strange issue in our iPad testings.

    image

    steps to reproduce issue:

    • hold iPad in landscpae (menu should be closed)
    • lay down iPad flat (on a table)
    • open menu

    any ideas what's going wrong here?

    opened by flandy84 6
  • Calling viewController from AppDelegate

    Calling viewController from AppDelegate

    I'm trying to open a viewController from didReceiveRemoteNotification in appDelegate but it is not doing anything while the same code is working fine in the LeftMenuViewController.Swift. So please how can I call the viewController from AppDelegate?

    func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
    
        let sideView = SSASideMenu()
        let storyboard = UIStoryboard(name: "MyProfile", bundle: nil)
        let vc = storyboard.instantiateViewControllerWithIdentifier("MyProfileViewController")
    
        sideView.contentViewController = vc
    }
    
    opened by LuaiKalkatawi 5
  • Facebook Login Issue

    Facebook Login Issue

    I'm having an issue when I log via Facebook the top of navigation bar becomes under the status bar in iOS 8 and 9.

    My progress is like this I click on the menu and it shows me the menu and I have a button that present the login view after I click on the Facebook login button the app takes me to the Facebook app and do the process and once it comes back I click on the view back the NavigationBar becomes under the status bar until I call the ViewController from the sideview and it becomes normal.

    opened by cancem123 4
  • Storyboard example; working with multiple screens

    Storyboard example; working with multiple screens

    No trouble getting the example to work, but I need some help setting up the workflow working with multiple screens. I am new to Swift, so any nudge into the right direction would be very well appreciated.

    In my storyboard I have the default setup from the example, with one Navigation Controller with the Storyboard ID of "FirstViewController". When I place a label on the connected ViewController it shows up after building the app. But when switching between Home to Calendar, and back to Home again, the screen is empty.

    I basically want to add another Navigation Controller for SecondViewController to be able to design the second screen (with just some labels and buttons, for example). But doing this (and setting the Storyboard ID / custom class) it just ignores my newly created ViewController

    switch indexPath.row {
    // [..]
    case 1:
        sideMenuViewController?.contentViewController = UINavigationController(rootViewController: SecondViewController())
    // [..]
    }
    

    Can I somehow change the "contentViewStoryboardID" in the case above, somehow? Or better yet, what would be the correct way to go about working with multiple screens and ViewControllers?

    opened by ronaldtveen 4
  • Storyboard example

    Storyboard example

    Anyone have a storyboard example? I've been trying to adopt the storyboard technique from the original RESideMenu code base, but havent had much luck with getting the background image to draw properly using this code base with storyboards, although the menus do function.

    opened by DigitalRogues 3
  • Navigation bar not showing on launch

    Navigation bar not showing on launch

    Hi, firstly this is a great piece of work.

    I am trying my hardest to get this working. the issue i am having is as soon as i launch my app the navigation bar at the top of the view is not there.

    But as soon as i swipe left and click on the home button again then the navigation controller bar appears a normal. Do you have an idea what could cause this?

    I have attached screenshots of my storyboard setup and launch image of the app. the code to add the left button and title is exactly the same as yours too

    thanks :)

    screen shot 2015-09-19 at 13 28 30 screen shot 2015-09-19 at 13 28 47

    opened by gristoi 2
  • contentViewController as UITabbar

    contentViewController as UITabbar

    Hi,

    I tried to customize the code so I can get a UITabbarController in lieu of the UIViewController you are using for the contentViewController. Everything works fine for iOS8 but not for iOS7 where the tabbar is just not appearing (the shadow is though). Do you have any idea about that issue?

    Thank you and congrats for the code.

    opened by redongjika 2
  • View controller items become nil when i call sideMenuViewController?.contentViewController = UINavigationController(rootViewController: HomeViewController())

    View controller items become nil when i call sideMenuViewController?.contentViewController = UINavigationController(rootViewController: HomeViewController())

    when the tableview delegate method in leftmenu viewcontroller is called, my home viewcontrollers items like table view become nil in viewdidload. I get this error when i call this code sideMenuViewController?.contentViewController = UINavigationController(rootViewController: HomeViewController()) my home viewcontroller items like button, tableview,etc., become nil when the viewDidLoad method is called. what could be the issue?

    opened by duraiganesh0 1
  • fatal error: unexpectedly found nil while unwrapping an Optional value at this line outDragDropCollectionView.draggingDelegate = self

    fatal error: unexpectedly found nil while unwrapping an Optional value at this line outDragDropCollectionView.draggingDelegate = self

    I have a requirement in my project to implement a Side Menu as well as a drag and drop animation. For this I am using SSASide and for Drag and drop I am using this library. I have managed to implement both the libraries individually in my project and when I mixed up both the Side Menu and Drag and Drop animation I am getting an error which is the title of this issue. I had a chat with Drag and Drop library creator it can be found here he said there is nothing wrong with his library. I need both the libraries to work in a same ViewController. When I set this ViewController as the root viewcontroller in Appdelegate like this

    ```
    
     let sideMenu = SSASideMenu(contentViewController: UINavigationController(rootViewController: HomeViewController()), leftMenuViewController: LeftMenuViewController(), rightMenuViewController: RightMenuViewController())
            sideMenu.backgroundImage = UIImage(named: "Background.jpg")
            sideMenu.configure(SSASideMenu.MenuViewEffect(fade: true, scale: true, scaleBackground: false))
            sideMenu.configure(SSASideMenu.ContentViewEffect(alpha: 1.0, scale: 0.7))
            sideMenu.configure(SSASideMenu.ContentViewShadow(enabled: true, color: UIColor.blackColor(), opacity: 0.6, radius: 6.0))
            sideMenu.delegate = self
    
            window?.rootViewController = sideMenu
            window?.makeKeyAndVisible()
    
    
    I get the error mentioned in the title in ViewController at this line, please check the image
    
    
    ![error](https://cloud.githubusercontent.com/assets/7767550/14599439/f3a6ccf0-0574-11e6-8935-6f1ea635e1f4.jpeg)
    
    is this occurs due to SSASideMenu??? Do I need any changes??? I need both to get work.
    
    opened by NuelNikhil 1
  • Adding SSASideMenu to an existing Project

    Adding SSASideMenu to an existing Project

    I have added the SSASideMenu to my project like the way it has shown in the example but when I run my project there a screen and an ash colour in the screen .. nothing else. what went wrong and How can I add it to my existing project???

    opened by NuelNikhil 1
  • Content view controller content jumps little to top on presenting side menu

    Content view controller content jumps little to top on presenting side menu

    The collection view in content view controller jumps a little to top on presenting side menu, and when the side menu is dimissed the content moves back to its original position. What could be the cause of this issue?

    opened by userSV 2
  • Disable fade menu

    Disable fade menu

    When i set the fadeMenuView property to false, the menu remains hidden while panning gesture. I guess the line 987 should be this way: menuViewContainer.alpha = fadeMenuView ? delta : 1

    My problem solved by changing it like that. Anyway, thank you very much for this amazing library

    opened by amadeomano 0
  • How to modify Navigation Bar?

    How to modify Navigation Bar?

    The navigation bar has a white bar and I would like to make it translucent. Calling the navigation bar in the view and making it translucent is not making a difference. Thanks

    opened by d7laungani 0
Owner
Sebastian
Sebastian
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
Slide Menu (Drawer) in Swift

AKSwiftSlideMenu Slide Menu (Drawer) in Swift 5.0 Why to use a library everytime? Let's create our own Slide Menu in Swift 5.0 I have uploaded a video

Ashish Kakkad 281 Jan 5, 2023
⭕️ 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
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
Interactive view transition to display menus with flowing and bouncing effects in Swift

FlowingMenu FlowingMenu provides an interactive transition manager to display menu with a flowing and bouncing effects. The Objective-C countepart is

Yannick Loriot 975 Dec 21, 2022
Our Guillotine Menu Transitioning Animation implemented in Swift reminds a bit of a notorious killing machine.

GuillotineMenu.swift Inspired by this project on Dribbble Also, read how it was done in our blog Requirements iOS 8.0+ Xcode 10 Swift 5.0 (v 4.1+) Swi

Yalantis 2.9k Dec 13, 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
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
✨ 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
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
The elegant yet functional dropdown menu, written in Swift, appears underneath the navigation bar to display a list of defined items when a user clicks on the navigation title.

Introduction The elegant yet functional dropdown menu, written in Swift, appears underneath the navigation bar to display a list of defined items when

Tho Pham 2.7k Dec 28, 2022
ExpandingMenu is menu button for iOS written in Swift.

ExpandingMenu ExpandingMenu is written in Swift. Requirements iOS 8.0+ Xcode 10.0+ Swift 3.x+ Installation CocoaPods You can install CocoaPods with th

null 454 Dec 7, 2022
Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift

Persei Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift! Made in Yalantis. Check this project on Dribbble Check th

Yalantis 3.4k Dec 14, 2022
A side menu controller written in Swift for iOS

Description SideMenuController is a custom container view controller written in Swift which will display the main content within a center panel and th

Teo 1.2k Dec 29, 2022
Hamburger Menu using Swift and iOS 8 API's

FrostedSidebar Hamburger Menu using Swift and iOS 8 API's Heavily influenced by @_ryannystrom's RNFrostedSidebar This implementation uses iOS 8's new

Evan Dekhayser 429 Oct 21, 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
Rotating circle menu written in Swift 3

Swift-CircleMenu A rotating circle menu written in Swift 3. Features Gesture based rotation Configurable rotatability High customisability Simple intu

Shoaib Ahmed 123 Jul 29, 2022