A ProMotion wrapper for SWRevealViewController
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
lib
spec
vendor
.gitignore
Gemfile
LICENSE.txt
README.md
Rakefile
motion_sw_reveal.gemspec

README.md

MotionSwReveal

A ProMotion wrapper for SWRevealViewController by John Lluch, heavily inspired on Promotion Slide Menu by Matt Brewer that depends on PKRevealController by Phillip Kluz. I could not get Promotion Slide Menu working on RubyMotion and ProMotion 1.1+. I have used SWRevealViewController before and I like it's ease of usage. This gem should be easy to use as well.

Installation

Add this line to your application's Gemfile:

gem 'motion_sw_reveal'

And then execute:

$ bundle

Or install it yourself as:

$ gem install motion_sw_reveal

Usage

Basic use:

# App Delegate

def on_load
  # Open a RevealScreen with:
  #  - NavigationScreen in the background.
  #  - HomeScreen as front screen.
  #
  open_reveal_screen NavigationScreen.new, HomeScreen.new(nav_bar: true)
end

This opens a new HomeScreen. Swiping it to the right will reveal the NavigationScreen.

If you want a button to show the NavigationScreen, just bind an action for it:

# Create a button (I use FontAwesome for the bars icon)
  def add_menu_button
    menu_btn = UIButton.buttonWithType UIButtonTypeRoundedRect
    menu_btn.setTitle FontAwesome.icon('bars'), forState: UIControlStateNormal
    menu_btn.setTitleColor hex_color('999999'), forState: UIControlStateNormal
    
    set_attributes menu_btn, {
      font:  FontAwesome.fontWithSize(20.0),
      frame: CGRectMake(0, 0, 30, 30)
    }

    @left_nav = UIBarButtonItem.alloc.initWithCustomView(menu_btn)
    self.navigationItem.leftBarButtonItem = @left_nav

    App.delegate.bind_reveal_screen_button menu_btn
  end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request