Skip to content

carlinisaacson/redpotion

 
 

Repository files navigation

image

RedPotion

We believe iPhone development should be clean, scalable, and fast with a language that developers not only enjoy, but actively choose. With the advent of Ruby for iPhone development the RubyMotion community has combined and tested the most active and powerful gems into a single package called RedPotion

RedPotion combines RMQ, ProMotion, CDQ, AFMotion, and MotionPrint. It also adds new features to better integrate RMQ with ProMotion. The goal is simply to choose standard libraries and promote best practices, allowing you to develop iOS apps in record time.

=========

The makers of RMQ at InfiniteRed and the creators of ProMotion at ClearSight as well as David Larrabee have teamed up to create the ultimate RubyMotion library.

image               image

ProMotion for screens and RMQ for styles, animations, traversing, events, etc.

Plugins and Add-ons

You can use both RMQ Plugins and ProMotion Add-ons

image

image

Quick start

gem install redpotion

potion create my_app
bundle
rake pod:install
rake

Installation

  • gem install redpotion

If you use rbenv

  • rbenv rehash

add it to your Gemfile:

  • gem 'redpotion'

Do NOT use RedPotion from github, we don't know why, but it will throw exceptions if you do; we're currently investigating why.

New generators to integrate RMQ & ProMotion nicely

Our new generates allow you to create your ProMotion screen and stylesheet template to let you hit the ground running. Currently the following RedPotion generators exist:

potion create screen foo
potion create table_screen foo
potion create view foo

# All rmq generators work with the potion command as well
potion create model foo
potion create shared foo
potion create lib foo

# rmq controller generators also still exist
# but screens are preferred to get the redpotion value
potion create controller foo
potion create collection_view_controller foos
potion create table_view_controller bars

# RedPotion includes CDQ and afmotion by default, if you don't need these gems
# we have provided command line tasks to remove either of them
potion remove cdq
potion remove afmotion

New features for RMQ

find is aliased to rmq so you can use it for a more natural reading code:

find.all.hide
find(my_view).children.nudge(right: 10)

You can use app directly in code, which is the same as rmq.app

So you also get window, device, and delegate from that.

app.device
app.window
app.delegate

You can use the following in a UIView or Screen or UIViewController without prefacing it with rmq:

append
append!
prepend
prepend!
create
create!
build
build!
on
apply_style
reapply_styles
style
color
image
stylesheet
stylesheet=

Stylesheet in your screens

You can specify the stylesheet in your screen like so:

class HomeScreen < PM::Screen
  title "RedPotion"
  stylesheet HomeStylesheet

  def on_load
  end
end

rmq_build can now be called on_load

You can use either rmq_build or on_load, they do exactly the same thing. You can only use one or the other. on_load is preferred as it matches the screen's onload.

class Section < UIView
  def on_load
    apply_style :section

    append(UIButton, :section_button).on(:touch) do
      mp "Button touched"
    end
  end
end

New features for ProMotion

ProMotion 2.2.0 added on_load and on_styled to match RedPotion

RedPotion specific features

UIColor has a with method. Allowing you to build a color from an existing color easily

# for example that time you want your existing color, but with a slight change
color.my_custom_color.with(a: 0.5)

Contributing

  1. Create an issue in GitHub to make sure your PR will be accepted.
  2. Fork it
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%