GithubHelp home page GithubHelp logo

arn00s / cariocamenu Goto Github PK

View Code? Open in Web Editor NEW
780.0 20.0 49.0 6.76 MB

The fastest zero-tap iOS menu.

Home Page: http://arn00s.github.io/cariocamenu/

License: MIT License

Ruby 1.21% Swift 98.79%
ui-components swift-3 menu-navigation swipe gesture-driven-animations ios ios-animation swift-library ios-ui

cariocamenu's Introduction

PRs Welcome Carthage compatible Version iOS 9.0+ Swift 4.0+ License CocoaPods Twitter URL

⚡️ Quicklook

The fastest zero-tap iOS menu

CariocaMenu is a simple, elegant, fast navigation menu for your iOS apps.

🏆 Features

  • Accessible from a single swipe of the left/right screen edge
  • Accessible with a tap on the indicator
  • Customisable menu indicator
  • Menu Item supports image & emoji/text
  • Boomerang mode
  • Supports rotation (Full AutoLayout)
  • Supports iPhone X & the Notch !
  • Complete Technical Documentation

📝 Requirements

  • AutoLayout
  • iOS 9.0+
  • Swift 4.0

📢 Communication

  • If you need help, use Stack Overflow. (Tag 'CariocaMenu')
  • If you'd like to ask a general question, use Stack Overflow.
  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.
  • If you use the control, contact me to mention your app on this page.

📲 Installation

CocoaPods

CariocaMenu is now available on CocoaPods. Simply add the following to your project Podfile, and you'll be good to go.

use_frameworks!

pod 'CariocaMenu', '~> 2.0.1'

Carthage

Carthage is a decentralised dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate CariocaMenu into your Xcode project using Carthage, specify it in your Cartfile:

github "arn00s/cariocamenu"

Run carthage to build the framework and drag the built CariocaMenu.framework into your Xcode project.

Manually

If you prefer, you can integrate CariocaMenu into your project manually.

Just Drag&Drop all the files under Sources/ into your project.


💻 Usage

Preparing your menu controller

To create and display your menu, you'll need to create a custom CariocaController (UITableViewController & CariocaDataSource)

This will define your menu settings & appearance. Check DemoMenuContentController.swift for code sample.

Creating your menu

For the complete code, check MainViewController.swift.

if let controller = self.storyboard?.instantiateViewController(withIdentifier: "DemoMenu")
    as? CariocaController {
      addChildViewController(controller)
      carioca = CariocaMenu(controller: controller,
                            hostView: self.view,
                            edges: [.right, .left],
                            delegate: self,
                            indicator: CariocaCustomIndicatorView()
                            )
      carioca.addInHostView()
}

Managing rotation

To be able to manage the rotation of the menu, you'll need to forward the rotation event to your menu instance.

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
  coordinator.animateAlongsideTransition(in: self.view, animation: nil, completion: { [weak self] _ in
    self?.carioca?.hostViewDidRotate()
  })
}

Creating your custom indicator

Here's the simplest custom indicator. Feel free to check the CariocaIndicatorConfiguration extension for more customisation possibilities.

class CariocaCustomIndicatorView: UIView, CariocaIndicatorConfiguration {
  ///This will use the basic shape, and change the color to black.
  var color: UIColor = UIColor.black
}

Boomerang

A boomerang always comes back to it's original place. By default, the boomerang is set to none. It means that the menu will stay where the user let it.

The other boomerang options are :

  • horizontal : The indicator will return always on the original edge.
  • vertical : The indicator will return always on the original Y position. It may switch from Edge.
  • originalPosition : The indicator will always come back to it's original position

👨‍💻 TODO

  • Add a check for the edges at the initialisation. (Only .left & .right are allowed)
  • Add UI Tests
  • Add a live tutorial to indicate users how to get the most of this menu

⚠️ Known issues

Check the (GitHub issues)

🤔 FAQ

😍 Why should I use CariocaMenu?

You're starting a new iOS app, and you want to innovate on the user experience.

🇧🇷 Why the name CariocaMenu?

I didn't want to use the same naming convention that EVERYONE uses. I could have named it ASSuperCoolMenu, but it sucks. A Carioca is someone who lives in Rio de Janeiro 🇧🇷. I lived there for two months, and this idea was born while I was there.

🤙🏼 Contact

❤️ Contributions

This is an open source project, feel free to contribute!

  • Open an issue.
  • Propose your own fixes, suggestions and open a pull request with the changes.

See all contributors

Project generated with SwiftPlate

📝 License

CariocaMenu is released under the MIT license. See LICENSE for details.

cariocamenu's People

Contributors

zigzagg16 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cariocamenu's Issues

Demo project doesn't work on iOS 13

I tried to run the Demo project, but it does not respond to pan gesture in the menu, could you check this?
just try to run it :)
Very thanks, I may use this library on the app I'm developing, and once then, I'll give you the link ❤️

Rotation Bug

The library doesn't handle well when rotating the screen.

Steps to reproduce

  • In portrait mode (Unlock rotation)
  • Open the menu
  • Scroll to About
  • Open the menu again
  • Rotate to landscape

Expected result

  • The Menu Centered in landscape mode

Actual Results

  • The Menu is half visible. (If you play it a couple of time, the menu button will disappear)

Many items in menu blows the app.

[x] There is no issue opened before about this.
[x] Issue is reproduceable in demo project.

What did I do?

  • Downloaded the demo project.
  • Wanted to check how it works with many menu items, so I copy pasted default menus 3 times. (4 times menu items at the end.) Change nothing else.
  • Ran on iPhone 6s with iOS 11.2.1

What happened?

  • CaroicaGestureManager.swift file, panned(yLocation:, edge:, state:, fromGesture:)method, line 76
  • let yRange: ClosedRange<CGFloat> = 20.0...frameHeight - container.menuHeight
  • Fatal error occured: Thread 1: Fatal error: Can't form Range with upperBound < lowerBound.
  • Reason: With 4x menu items, container.menuHeight became greater than frameHeight I suppose.

icon is too big

Hey! I am trying to apply icon instead of emoji but the problem is that the icon is way too big. This is how I add icon:

var menuItems: [CariocaMenuItem] = [
        CariocaMenuItem("Test1", .icon(UIImage(named: "test1Icon")!)),
        CariocaMenuItem("Test2", .icon(UIImage(named: "test2Icon")!))
    ]

This is the output:

screen shot 2018-03-13 at 02 05 07

My icon is 15x15

Dismiss Viewcontroller

Hey, I am trying to dismiss presented ViewController but instead on dismissing, it goes to Carioca's default viewcontrollerViewController. My initial ViewController is UINavigationController but I do not think that is an issue. Is it a bug or I am stupid?

And this is how I present:

let emptyViewController = EmptyViewViewController.fromStoryboard()
present(emptyViewController, animated: true, completion: nil)

Menu uses too much memory

What did I do?

  • Downloaded the demo project and ran it on iPhone 6s with iOS 11.2.1 without any modification.
  • Travelled between content pages many times. (Not to be a prick, just to present the menu to my collegues.)

What happened?

  • Memory usage gone beyond 150 MB.

Any ideas?

I traced the memory usage while travelling between pages. I saw 2 things.

  • WebView data is not released when you go to another page.
  • MapView data is released but not completely when you go to another page.

I don't know if these are issues about the menu, or something else, but false alarm better than no alarm :]

Unknown error in the app after I did like example demo ?

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[test.MainViewController cariocaMenuDidSelect:indexPath:]: unrecognized selector sent to instance 0x7ffa48e00be0'

this happen when ever I click on cell for the menu.

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.