All Projects → handsomecode → Interactivesidemenu

handsomecode / Interactivesidemenu

Licence: apache-2.0
iOS Interactive Side Menu written in Swift.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Interactivesidemenu

Aksidemenu
Beautiful iOS side menu library with parallax effect. Written in Swift
Stars: ✭ 216 (-67.66%)
Mutual labels:  cocoapods, carthage, sidemenu
Sidemenu
An interactive iOS side menu with rich features.
Stars: ✭ 442 (-33.83%)
Mutual labels:  cocoapods, carthage, sidemenu
Sidemenu
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.
Stars: ✭ 5,267 (+688.47%)
Mutual labels:  cocoapods, carthage, sidemenu
Urlembeddedview
URLEmbeddedView automatically caches the object that is confirmed the Open Graph Protocol.
Stars: ✭ 633 (-5.24%)
Mutual labels:  cocoapods, carthage
Orsserialport
Serial port library for Objective-C and Swift macOS apps
Stars: ✭ 609 (-8.83%)
Mutual labels:  cocoapods, carthage
Sablurimageview
You can use blur effect and it's animation easily to call only two methods.
Stars: ✭ 538 (-19.46%)
Mutual labels:  cocoapods, carthage
Swiftframeworktemplate
A template for new Swift iOS / macOS / tvOS / watchOS Framework project ready with travis-ci, cocoapods, Carthage, SwiftPM and a Readme file
Stars: ✭ 527 (-21.11%)
Mutual labels:  cocoapods, carthage
Flyoverkit
360° flyover on a MKMapView 🚁
Stars: ✭ 666 (-0.3%)
Mutual labels:  cocoapods, carthage
Sdwebimage
Asynchronous image downloader with cache support as a UIImageView category
Stars: ✭ 23,928 (+3482.04%)
Mutual labels:  cocoapods, carthage
Pdfgenerator
A simple generator of PDF written in Swift.
Stars: ✭ 629 (-5.84%)
Mutual labels:  cocoapods, carthage
Flexiblepagecontrol
A flexible UIPageControl like Instagram.
Stars: ✭ 638 (-4.49%)
Mutual labels:  cocoapods, carthage
Multiprogressview
📊 An animatable view that depicts multiple progresses over time. Modeled after UIProgressView
Stars: ✭ 614 (-8.08%)
Mutual labels:  cocoapods, carthage
Stlocationrequest
Request the Location Services via a 3D 360° flyover MKMapView 🗺
Stars: ✭ 636 (-4.79%)
Mutual labels:  cocoapods, carthage
Gradientview
Easily use gradients in UIKit for iOS & tvOS
Stars: ✭ 610 (-8.68%)
Mutual labels:  cocoapods, carthage
Bow
🏹 Bow is a cross-platform library for Typed Functional Programming in Swift
Stars: ✭ 538 (-19.46%)
Mutual labels:  cocoapods, carthage
Swiftinstagram
Instagram API client written in Swift
Stars: ✭ 570 (-14.67%)
Mutual labels:  cocoapods, carthage
Haptica
Easy Haptic Feedback Generator 📳
Stars: ✭ 587 (-12.13%)
Mutual labels:  cocoapods, carthage
Jlroutes
URL routing library for iOS with a simple block-based API
Stars: ✭ 5,528 (+727.54%)
Mutual labels:  cocoapods, carthage
Openssl
OpenSSL package for SPM, CocoaPod, and Carthage, for iOS and macOS
Stars: ✭ 515 (-22.9%)
Mutual labels:  cocoapods, carthage
Anim
Swift animation library for iOS, tvOS and macOS.
Stars: ✭ 520 (-22.16%)
Mutual labels:  cocoapods, carthage

Swift version: 5.0 CocoaPods: 2.3.1 Carthage compatible License: Apache 2.0

Interactive Side Menu

A customizable, interactive, auto expanding and collapsing side menu for iOS written in Swift.

Here are some of the ways Interactive Side Menu can be customized:

  • Animation duration
  • Visible content width
  • Content scale
  • UIView spring animations
  • Animation curves
  • Customized animation settings for different orientations

Communication

  • If you need help or found a bug, please, open an issue.
  • If you have a feature request, open an issue.
  • If you are ready to contribute, submit a pull request.
  • If you like Interactive Side Menu, please, give it a star.
  • If you use Interactive Side Menu in your application published to AppStore, send us a link and we'll create the list with applications used our library.

You can find more details into CONTRIBUTING file.

Installation

CocoaPods

To install using CocoaPods, add the following line to your Podfile:

pod 'InteractiveSideMenu'

Please, don't forget to run pod update command to update your local specs repository during migration from one version to another.

Carthage

To install using Carthage, add the following line to your Cartfile:

github "handsomecode/InteractiveSideMenu"

Usage

To implement your side menu you should subclasses the following view controllers: MenuContainerViewController and MenuViewController

  • MenuContainerViewController is the main container that hosts the side menu and content controller
  • MenuViewController is the container controller for the side menu

To add a new menu item, your view controller needs to conform to the SideMenuItemContent protocol.

Setting up the side menu can be done in three steps:

For this, Host = MenuContainerViewController subclass and Menu = MenuViewController subclass
  1. Assign Menu to the menuViewController property of Host
  2. Set the Host's contentViewControllers array with an array of SideMenuItemContent controllers
  3. Call selectContentViewController(_ selectedContentVC: MenuItemContentViewController) from Host
import InteractiveSideMenu

class HostViewController: MenuContainerViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        menuViewController = self.storyboard!.instantiateViewController(withIdentifier: "NavigationMenu") as! MenuViewController
	contentViewControllers = contentControllers()
        selectContentViewController(contentViewControllers.first!)
    }

    private func contentControllers() -> [MenuItemContentViewController] {
    	var contentList = [MenuItemContentViewController]()
    	contentList.append(self.storyboard?.instantiateViewController(withIdentifier: "First") as! MenuItemContentViewController)
    	contentList.append(self.storyboard?.instantiateViewController(withIdentifier: "Second") as! MenuItemContentViewController)
    	return contentList
    }
}

Items content

To show menu, call showSideMenu() from any SideMenuItemContent controller.

import InteractiveSideMenu

class KittyViewController: UIViewController, SideMenuItemContent {
    
    @IBAction func openMenu(_ sender: UIButton) {
        showSideMenu()
    }
}

To change the currently visible controller, pass the desired controller to your MenuContainerViewController:

    let index = 2 // Second menu item
    guard let menuContainerViewController = self.menuContainerViewController else { return }
    let contentController = menuContainerViewController.contentViewControllers[index]
    menuContainerViewController.selectContentViewController(contentController)
    menuContainerViewController.hideSideMenu()

TabBar and Navigation controllers

To use menu with TabBar or NavigationController, ensure that you indicate UITabBarController or UINavigationController as item content directly, not any corresponding ViewControllers.

class NavigationViewController: UINavigationController, SideMenuItemContent {
}

class InnerViewController: UIViewController {

    @IBAction func openMenu(_ sender: Any) {
        if let navigationViewController = self.navigationController as? SideMenuItemContent {
            navigationViewController.showSideMenu()
        }
    }
}

Please, find UITabBarController implementation details in Sample.

Animation Customization

To customize the open and close animations, update the transitionOptions property on your MenuContainerViewColtroller subclass. The sample project does this in viewDidLoad()

override func viewDidLoad() {
   super.viewDidLoad()
   let screenSize: CGRect = UIScreen.main.bounds
   self.transitionOptions = TransitionOptions(duration: 0.4, visibleContentWidth: screenSize.width / 6)
   ...
}

To customize transition options for different orientations, override viewWillTransition(to:with:) and update the transitionOptions. This can also be done with trait collections using traitCollectionDidChange(_:)

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
    super.viewWillTransition(to: size, with: coordinator)
    var options = TransitionOptions()
    options.duration = size.width < size.height ? 0.4 : 0.6
    options.visibleContentWidth = size.width / 6
    self.transitionOptions = options
}

Check out the Sample project for more details and usage examples.

Known Issues

There is an issue associated with the content controller's view not properly having the safeAreaInsets set. This causes the view's layout to shift when the side menu is closed. The issue appears to be tied to the transition options contentScale setting. Choosing a value in the range 0.87 - 0.91 causes the safeAreaInsets.top to be set to 0.0. The default value of the library is no longer within this range but be mindful if changing that value for your own application.

Requirements

  • iOS 8.0+
  • Xcode 8.1+
  • Swift 3.0+

License

InteractiveSideMenu is available under the Apache License, Version 2.0. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].