Latest 1.2.1
Homepage https://github.com/gridNA/GNAContextMenu
License MIT
Platforms ios 11.0, requires ARC
Authors

Carthage compatible

Long press context menu (like in Pintrest for iOS app)

Requirements

  • iOS 11.0+
  • Xcode 9.3+

Installation

The easiest way is through CocoaPods. Simply add the dependency to your Podfile and then pod install:

 pod `GNAContextMenu`

Or Carthage. Add the depdency to your Cartfile and then carthage update:

github "gridNA/GNAContextMenu"

How

import GNAContextMenu

1) add on view in UIViewController, where you plan to use context menu

UILongPressGestureRecognizer

2) create GNAMenuView and set delegate

var menuView = GNAMenuView(menuItems: 
              [GNAMenuItem(icon: UIImage(named: "shopingCart_inactive"), 
                           activeIcon: UIImage(named: "shopingCart"), 
                           title: "Shop it"), 
              GNAMenuItem(icon: UIImage(named: "wishlist_inacitve"), 
                          activeIcon: UIImage(named: "wishlist"), 
                          title: "Wish")])
menuView.delegate = self

3) on long press

 menuView.handleGesture(gesture, inView: yourView)

You can also implement GNAMenuItemDelegate methods:

  menuItemWasPressed(menuItem: GNAMenuItem, info: [String: AnyObject]?)
  menuItemActivated(menuItem: GNAMenuItem, info: [String: AnyObject]?)
  menuItemDeactivated(menuItem: GNAMenuItem, info: [String: AnyObject]?)

Please see example for more info.

Example

Example

Latest podspec

{
    "name": "GNAContextMenu",
    "version": "1.2.1",
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "4.1"
    },
    "summary": "Long press context menu written in swift",
    "description": "Long press context menu (like in Pintrest for iOS app)",
    "homepage": "https://github.com/gridNA/GNAContextMenu",
    "license": {
        "type": "MIT",
        "file": "License"
    },
    "authors": {
        "KaterynaGridina": "[email protected]"
    },
    "source": {
        "git": "https://github.com/gridNA/GNAContextMenu.git",
        "tag": "1.2.1"
    },
    "platforms": {
        "ios": "11.0"
    },
    "requires_arc": true,
    "source_files": "gnaContextMenu/GNAContextMenu/*.swift"
}

Pin It on Pinterest

Share This