{"id":16684538,"url":"https://github.com/saoudrizwan/pushmenu","last_synced_at":"2025-03-21T18:32:55.139Z","repository":{"id":62451288,"uuid":"84809175","full_name":"saoudrizwan/PushMenu","owner":"saoudrizwan","description":"A new menu for iOS, using the power of 3D Touch.","archived":false,"fork":false,"pushed_at":"2019-05-23T13:12:21.000Z","size":548,"stargazers_count":74,"open_issues_count":0,"forks_count":12,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-03-16T00:02:22.422Z","etag":null,"topics":["3d-touch","ios","ipad","iphone","swift","xcode"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saoudrizwan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["sdrzn"],"patreon":"sdrzn","open_collective":null,"ko_fi":null,"tidelift":null,"custom":"http://saoud.org"}},"created_at":"2017-03-13T09:41:10.000Z","updated_at":"2023-06-08T02:02:26.000Z","dependencies_parsed_at":"2022-11-01T22:46:16.596Z","dependency_job_id":null,"html_url":"https://github.com/saoudrizwan/PushMenu","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saoudrizwan%2FPushMenu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saoudrizwan%2FPushMenu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saoudrizwan%2FPushMenu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saoudrizwan%2FPushMenu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saoudrizwan","download_url":"https://codeload.github.com/saoudrizwan/PushMenu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244153316,"owners_count":20406996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d-touch","ios","ipad","iphone","swift","xcode"],"created_at":"2024-10-12T14:44:12.548Z","updated_at":"2025-03-21T18:32:54.688Z","avatar_url":"https://github.com/saoudrizwan.png","language":"Swift","funding_links":["https://github.com/sponsors/sdrzn","https://patreon.com/sdrzn","http://saoud.org"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://cloud.githubusercontent.com/assets/7799382/23850750/fcc01ffe-079d-11e7-8d25-5a683f38a1a8.png\" alt=\"PushMenu\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://cloud.githubusercontent.com/assets/7799382/23857833/d92e676c-07bb-11e7-95f7-90f91d643dbc.png\" alt=\"Platform: iOS 10+\" /\u003e\n    \u003ca href=\"https://developer.apple.com/swift\" target=\"_blank\"\u003e\u003cimg src=\"https://cloud.githubusercontent.com/assets/7799382/23857836/da3cbb72-07bb-11e7-8e7e-2019da085799.png\" alt=\"Language: Swift 3\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://cocoapods.org/pods/PushMenu\" target=\"_blank\"\u003e\u003cimg src=\"https://cloud.githubusercontent.com/assets/7799382/23857849/dfb863bc-07bb-11e7-9e0e-17f49acd419a.png\" alt=\"CocoaPods compatible\" /\u003e\u003c/a\u003e\n    \u003cimg src=\"https://cloud.githubusercontent.com/assets/7799382/23857856/e384cac6-07bb-11e7-9ebe-c4c1a039c8b1.png\" alt=\"License: MIT\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\n  • \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\n  • \u003ca href=\"#7-options-limit\"\u003e7 Options Limit\u003c/a\u003e\n  • \u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\nPushMenu is a **revolutionary** iOS component that can easily be added to any `UIView`. PushMenu displays options which users can select **without lifting a finger**, either by using 3D Touch or sliding their finger across the menu. A cell in the menu is highlighted based on the amount of force the user applies to his screen. After a delay, that highlighted cell gets selected and its associated action gets called. PushMenu feels **right at home** with the iOS ecosystem and is a **new, yet comfortable** approach to displaying menu options to users.  \n\n**Note:** *PushMenu works on all devices - users with devices that don't support 3D Touch can simply use the backup sliding mechanism to choose options.*\n\n## Demo\n*Most simulators don't have 3D Touch capabilites, it's recommended to run the example project on a device.*\n\nThe first demo is of PushMenu with 3D Touch in action. The other demos are of the backup sliding mechanism.\n\n\u003ca href=\"https://www.youtube.com/watch?v=Tv_EV6f8XDY\" target=\"_blank\"\u003e\u003cimg src=\"https://cloud.githubusercontent.com/assets/7799382/23856687/b89c6f52-07b7-11e7-8490-f3ca9cf79ab0.png\" alt=\"video demo\" width=\"290\" height=\"518\" border=\"0\" /\u003e\u003c/a\u003e\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/7799382/23855695/f074bf8c-07b3-11e7-8a8c-d17e2dde947e.gif\" alt=\"demo\" width=\"290\" height=\"518\" border=\"0\" /\u003e\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/7799382/23855696/f086d53c-07b3-11e7-9fbe-0e25ee7a7809.gif\" alt=\"demo\" width=\"290\" height=\"518\" border=\"0\" /\u003e\n\n## Quick Start\n```swift\nimport PushMenu\n\nclass MyViewController: UIViewController {\n\n    let photo = UIView()\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \n        photo.pushMenu.isEnabled = true\n        photo.pushMenu.addCell(title: \"Cancel\", type: .cancel, action: nil)\n        photo.pushMenu.addCell(title: \"Save to Library\", type: .normal, action: {\n            // ...\n        })\n    }\n}\n```\n\nPushMenu is **customizable**. That means you can configure:\n* `.opacity`\n* `.cellHeight`\n* `.font`\n* `.style` (`.light` or `.dark`)\n* `.selectionDelay`\n\n## Compatibility\n\nPushMenu requires **iOS 9+** and is compatible with **Swift 3** projects.\n\n## Installation\n\n* Installation for \u003ca href=\"https://guides.cocoapods.org/using/using-cocoapods.html\" target=\"_blank\"\u003eCocoaPods\u003c/a\u003e:\n\n```ruby\nplatform :ios, '9.0'\ntarget 'ProjectName' do\nuse_frameworks!\n\npod 'PushMenu'\n\nend\n```\n* Or drag and drop the PushMenu framework into your project.\n\nAnd `import PushMenu` in the files you'd like to use it.\n\n## Usage\n\n*It's recommended to look through the example project—it has detailed documentation of everything PushMenu has to offer.*\n\n**Note:** throughout this document, `photo` will act as the view being animated. You can use PushMenu on any instance of a `UIView` or `UIView` subclass, such as `UILabel`, `UITextField`, `UIButton`, etc.\n\n**Using PushMenu is easy.**\n\n1. [Enable](#enabling-pushmenu) PushMenu for the view.\n\n2. [Customize](#customizing-a-pushmenu) your view's PushMenu.\n\n3. [Add option cells](#adding-option-cells).\n\n### Enabling PushMenu\nEnabling PushMenu for a view automatically creates a new instance of a `PushMenu` and attaches a `PushMenuGestureRecognizer` to the view.\n\n**Note:** You must enable pushMenu first before adding cells or customizing it (see below.)\n```swift\nphoto.pushMenu.isEnabled = true\n```\nSetting this value to `false` will result in the `PushMenu` instance and `PushMenuGestureRecognizer` being removed.\n\n### Customizing a PushMenu\nPushMenu wouldn't be cool if you couldn't customize it for your use case.\n\n**Style**: `.light` or `.dark` (more themes will be available in future releases, feel free to contribute and add your own themes!)\n```swift\nphotoView.pushMenu.style = .dark // default is .light\n```\n**Opacity**: the alpha value of the cells' background colors.\n```swift\nphotoView.pushMenu.opacity = 0.75 // default is 1.0\n```\n**Cell Height**: the height for each option cell.\n```swift\nphotoView.pushMenu.cellHeight = 45 // default is 55\n```\n**Font**: the font for the cells' title labels.\n```swift\nphotoView.pushMenu.font = UIFont.systemFont(ofSize: 16, weight: UIFontWeightMedium) // default is UIFont.systemFont(ofSize: 18, weight: UIFontWeightMedium)\n```\n**Selection Delay**: how long it takes (in seconds) for a highlighted cell to become selected.\n```swift\nphotoView.pushMenu.selectionDelay = 0.7 // default is 0.45\n```\n\n### Adding Option Cells\nPushMenu can only have 7 options - [why?](#7-options-limit)\n\nAll PushMenus should have a cancel option first. Cancel options don't become selected, giving users as much time as they need to decide what option they want.\nApple says the average force is ~ 1.0, the amount of force that is needed to highlight the first cell, which is why it's important that the first cell is of cancel type.\n```swift\nphotoView.pushMenu.addCell(title: \"Cancel\", type: .cancel, action: nil)\n```\nThen you can add normal options:\n```swift\nphotoView.pushMenu.addCell(title: \"Save to Library\", type: .normal, action: {\n    // this closure gets called immediately after this cell is selected\n})\n```\n... or destructive options:\n```swift\nphotoView.pushMenu.addCell(title: \"Delete Image\", type: .destructive, action: {\n    // ...\n})\n```\n\n## 7 Options Limit\nMost devices that have 3D Touch capabilites have a maximum force of 6.6666667, and Apple says that an average touch's force is ~1.0. PushMenu was built with this in mind, so each option cell of a menu takes 1 force unit. Meaning a force of 0-1 will highlight the first cell, a force of 1-2 will highlight the second cell, and so on until the 7th cell which gets highlighted from a force of 6 or above. A force unit of 1 is small, yet comfortable enough for a user to get a feel of what amount of pressure it takes to get to a certain cell.\n\n## Documentation\nOption + click on any of PushMenu's properties/methods for detailed documentation.\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/7799382/23852846/0eec6940-07a7-11e7-88a5-03b7063af8f1.png\" alt=\"documentation\"\u003e\n\n## License\n\nPushMenu uses the MIT license. Please file an issue if you have any questions or if you'd like to share how you're using PushMenu.\n\n## Contribute\n\nPushMenu is at its first stage, but is robust and powerful enough to be used in production-ready apps. Please feel free to submit pull requests, even if your addition/revision is minor. \nHere is a list of things to work on for future releases:\n* more themes besides `.light` and `.dark`\n\n## Questions?\n\nContact me by email \u003ca href=\"mailto:hello@saoudmr.com\"\u003ehello@saoudmr.com\u003c/a\u003e, or by twitter \u003ca href=\"https://twitter.com/sdrzn\" target=\"_blank\"\u003e@sdrzn\u003c/a\u003e. Please create an \u003ca href=\"https://github.com/saoudrizwan/PushMenu/issues\"\u003eissue\u003c/a\u003e if you come across a bug or would like a feature to be added.\n\n## Credits\nTouch icon by [iconsphere from the Noun Project](https://thenounproject.com/iconsphere/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaoudrizwan%2Fpushmenu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaoudrizwan%2Fpushmenu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaoudrizwan%2Fpushmenu/lists"}