Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ruby, Meet iPhone

Ruby, Meet iPhone

RubyMotion transports the dynamic language ethos and Ruby language to iOS all at once. The language is flexible and dynamic. Instead of in dialogs, configuration happens in a text file using a simple internal Ruby DSL. Apps running in the simulator include a REPL for code evaluation. There’s even a built-in way to click on object in an app for dynamic introspection and manipulation. In this talk, we’ll introduce RubyMotion, the platform’s development tools and workflow, and third-party libraries that push the state of the art in iOS developer tools. We’ll show some example apps and reflect on experiences building real-world production apps in Ruby.

Atomic Object

May 04, 2013
Tweet

More Decks by Atomic Object

Other Decks in Technology

Transcript

  1. @atomicobject http://spin.atomicobject.com A Tour of RubyMotion • Implementation of Ruby

    • Similar object model to Objective C, natural language for the platform • UNIX Ethos • Very Flexible
  2. From our app directory, we can run our app in

    the simulator with a simple command.
  3. Classes and methods; no header files; rest arguments. What you

    don’t see in the usual case is the flexibility of Ruby.
  4. do is syntax for blocks. Very similar to Objective C

    blocks parent= is just a method assumed to exist on el. Aliases to setParent if el is an Objective C object.
  5. These features of ruby make it great for creating internal

    DSLs. Why create separate parsers for incomplete languages when your primary language is so flexible?
  6. Unlike most languages, there are no contexts where you can’t

    put code. For example, within a class definition, you can do whatever you want.
  7. Checking of valid objects in ActiveRecord validates is a method

    on class objects inheriting from ActiveRecord::Base
  8. Now, if we hold command and click on an element,

    the context of our REPL changes to the clicked element. Right now our REPL says (main), meaning we haven’t clicked an element.
  9. So we can set self.backgroundColor to see it change to

    red. Or we can tweak frame size to get the positioning just right.