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

Rubymotion. Sugar for iOS.

Rubymotion. Sugar for iOS.

Cocoaheads, Grodno, December, 2013

Aliaksandr Lomau

December 07, 2013
Tweet

More Decks by Aliaksandr Lomau

Other Decks in Technology

Transcript

  1. How it works? 1 2 3 4 RUBY CODE AST

    (semantic tree) LLVM IR Machine code Ruby parser RubyMotion LLVM code generator
  2. How it works? # Ruby "Hello BRUG".class.ancestors => [String, Comparable,

    Object, Kernel, BasicObject] # RubyMotion "Hello BRUG".class.ancestors => [String, NSMutableString, NSString, Comparable, NSObject, Kernel] OBJECTS
  3. send def tableView(tableView, didSelectRowAtIndexPath:indexPath) menu_row = self.menu_items[indexPath.row] # => 'profile'

    self.send("open_#{menu_row}") end ! def open_profile; #...; end def open_messages; #...; end ! def open_feed; # ...; end
  4. define_method module Mouth def self.can_say(name) define_method("say_#{name}") do name.upcase end end

    end ! class Person include Mouth can_say :hello end ! person.say_hello # => "HELLO"
  5. 20.times do rmq.append(UIButton).tag(:foo).move(l: rand(200), t: rand(500), w: 80, h: 20).style

    do |st| st.text = rand(200).to_s st.background_color = rmq.color.blue end end RMQ
  6. TDD RubyMotion integrates Bacon Bacon is small clone of the

    popular RSpec it can simulate user behaviour on device