Giter VIP home page Giter VIP logo

jvmenu's Introduction

JVMenu

Simple iOS Menu written in Swift. Currently only supports portrait mode, might look into to enhance it to support landscape as well. Decided to shared it, as I'm using in one of my apps.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

You can make any of your objects to conform to the JVMenuProtocol like shown in the BaseMenuViewController. Then, you will simply will need to conform the protocol functions.

extension BaseMenuViewController: JVMenuProtocol {

    func selectedMenuItem(row: Int) {
        // push or do any work based on menu selection...
        print(row)
    }
    
    var data: JVMenuDataModel {
        return JVMenuDataModel(items)
    }
}

The first function selectedMenuItem will get called indicating which menu object was selected based on the row. Then, the variable data of type JVMenuDataModel will provide all the customization for the menu, like: menu items, background color, row height, font, text color and the table separator color. You could use the default implementation and just specified the menu items as shown on the BaseMenuViewController...

private var items: [JVMenuItem] {
	return [JVMenuItem(icon: UIImage(named: "icons8-settings")!, title: "First Menu 1"),
			JVMenuItem(icon: UIImage(named: "icons8-settings")!, title: "Second Menu 2"),
			JVMenuItem(icon: UIImage(named: "icons8-settings")!, title: "Third Menu 3"),
			JVMenuItem(icon: UIImage(named: "icons8-settings")!, title: "Forth Menu 4"),
			JVMenuItem(icon: UIImage(named: "icons8-settings")!, title: "Fifth Menu 5"),
			JVMenuItem(icon: UIImage(named: "icons8-settings")!, title: "Sixth Menu 6")]
}

This array of JVMenuItem will contain each icon to be used an title for the menu.

Finally, you can call some of the default implementations like showMenu() or hideMenu (if needed as the menu hides automatically after a menu option is selected or if it's dismissed by the gestures).

Note: This menu gets added to the UIWindown and also is a singleton instance.

Requirements

Currently, only supporting latest iOS 13.4. Sorry! :/

Installation

JVMenu is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'JVMenu'

Author

JV17, [email protected]

License

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

jvmenu's People

Contributors

jv17 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.