All Projects → umerjabbar → ContextMenuSwift

umerjabbar / ContextMenuSwift

Licence: other
A better version of iOS 13 Context Menu

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to ContextMenuSwift

Ngcontextmenu
Handcraft your very own context menus for a richer UX!
Stars: ✭ 81 (-50%)
Mutual labels:  menu, contextmenu, context-menu
Yndropdownmenu
✨ Awesome Dropdown menu for iOS with Swift 5.0
Stars: ✭ 1,259 (+677.16%)
Mutual labels:  menubar, dropdown, menu
JonContextMenu
A beautiful and minimalist arc menu like the Pinterest one, written in Swift
Stars: ✭ 60 (-62.96%)
Mutual labels:  menu, contextmenu, context-menu
Vue Dock Menu
⚓Dockable Menu bar for Vue
Stars: ✭ 183 (+12.96%)
Mutual labels:  menubar, menus, menu
Context Menu.ios
You can easily add awesome animated context menu to your app.
Stars: ✭ 1,854 (+1044.44%)
Mutual labels:  menu, contextmenu, context-menu
React Menu
React component for building accessible menu, dropdown, submenu, context menu and more.
Stars: ✭ 237 (+46.3%)
Mutual labels:  dropdown, menu, contextmenu
vue3-context-menu
A very simple context menu component for Vue3 一个简洁美观简单的Vue3右键菜单组件
Stars: ✭ 74 (-54.32%)
Mutual labels:  menu, contextmenu, context-menu
clicky-menus
Simple click-triggered navigation submenus. Accessible and progressively enhanced.
Stars: ✭ 76 (-53.09%)
Mutual labels:  dropdown, menu
Chinese Lunar Calendar For Mac
Chinese Lunar Calendar for Mac
Stars: ✭ 150 (-7.41%)
Mutual labels:  menubar, menu
React Site Nav
A kick ass site menu powered by styled components inspired by Stripe.
Stars: ✭ 155 (-4.32%)
Mutual labels:  menubar, menu
Side Menu.ios
Animated side menu with customizable UI
Stars: ✭ 2,702 (+1567.9%)
Mutual labels:  menubar, menu
Ngsplitmenucontroller
Menu Driven Split view controller
Stars: ✭ 61 (-62.35%)
Mutual labels:  menubar, menu
Radialmenu
A highly customizable radial menu that's very easy to setup.
Stars: ✭ 371 (+129.01%)
Mutual labels:  menubar, menu
Nocturnal
A Dimness and Night Shift menu bar app for macOS 🌙
Stars: ✭ 199 (+22.84%)
Mutual labels:  menubar, menu
ShellAnything
ShellAnything is a C++ open-source software which allow one to easily customize and add new options to *Windows Explorer* context menu. Define specific actions when a user right-click on a file or a directory.
Stars: ✭ 103 (-36.42%)
Mutual labels:  contextmenu, context-menu
Superslide.js
A flexible, smooth, GPU accelerated sliding menu for your next PWA
Stars: ✭ 496 (+206.17%)
Mutual labels:  menubar, menu
Spotmenu
Stars: ✭ 2,668 (+1546.91%)
Mutual labels:  menubar, menu
ng2-right-click-menu
Right click context menu for Angular 2+
Stars: ✭ 51 (-68.52%)
Mutual labels:  contextmenu, context-menu
ember-right-click-menu
An easy and flexible addon to add context menus anywhere in your application
Stars: ✭ 14 (-91.36%)
Mutual labels:  menu, context-menu
ctxmenu
Tiny and customizable context menu generator
Stars: ✭ 20 (-87.65%)
Mutual labels:  contextmenu, context-menu

ContextMenuSwift

Linkedin: umerjabbar Twitter: @Umer_Jabbar License Xcode 10.0+ iOS 10.0+ Swift 4.0+ Cocoapods

Installation 📱

Just add ContextMenuSwift to your Podfile and pod install. Done!

pod 'ContextMenuSwift'

Usage

Example 1

Show the menu of string values on your view

CM.items = ["Item 1", "Item 2", "Item 3"]
CM.showMenu(viewTargeted: YourView, delegate: self, animated: true)

Example 2

Update menu items async

CM.items = ["Item 1", "Item 2", "Item 3"]
CM.showMenu(viewTargeted: YourView, delegate: self, animated: true)
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
    CM.items = ["Item 1"]
    CM.updateView(animated: true)
}

Example 3

Update targeted view async

CM.items = ["Item 1", "Item 2", "Item 3"]
CM.showMenu(viewTargeted: YourView, delegate: self, animated: true)
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
    CM.changeViewTargeted(newView: YourView)
    CM.updateView(animated: true)
}

Example 4

Show menu with icons

let share = ContextMenuItemWithImage(title: "Share", image: #imageLiteral(resourceName: "icons8-upload"))
let edit = "Edit"
let delete = ContextMenuItemWithImage(title: "Delete", image: #imageLiteral(resourceName: "icons8-trash"))
CM.items = [share, edit, delete]
CM.showMenu(viewTargeted: YourView, delegate: self, animated: true)

Delegate

You can check events by implement ContextMenuDelegate

extension ViewController : ContextMenuDelegate {
    
    func contextMenu(_ contextMenu: ContextMenu, targetedView: UIView, didSelect item: ContextMenuItem, forRowAt index: Int) -> Bool {
        print(item.title)
        return true //should dismiss on tap
    }
    
    func contextMenuDidAppear(_ contextMenu: ContextMenu) {
        print("contextMenuDidAppear")
    }
    
    func contextMenuDidDisappear(_ contextMenu: ContextMenu) {
        print("contextMenuDidDisappear")
    }
 
}

Requirements

  • Xcode 9+
  • Swift 4.0
  • iOS 10+

License

This project is under MIT license. For more information, see LICENSE file.

Credits

ContextMenuSwift was developed while trying to implement iOS 13 context menu with a tap gesture.

It will be updated when necessary and fixes will be done as soon as discovered to keep it up to date.

You can find me on Twitter @Umer_Jabbar and Linkedin umerjabbar.

Enjoy! 🤓

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].