LAURENT SANSONETTI • Creator/maintainer of MacRuby • Left Apple, disappeared for awhile, re-emerged having created a startup that brings iOS development to Ruby • Plans to contribute parts of this work back to MacRuby
OBJECTIVE-C • Third-party libs still Objective-C, you need to know how to read it • RubyMotion syntax adds sanity but doesn't get rid of Objective-C textfromxcode.com
WHAT IS IT? • Port of MacRuby for iOS • Ruby implementation on top of the Objective-C runtime and iOS foundation classes • Easiest Ruby version you'll ever install
IS IT LIKE PHONEGAP? • No limits on APIs you can use because it's not wrapping APIs - the entire SDK is available and you implement Apple APIs directly • It does not bridge objects, it creates Objective-C objects directly • It does not run a bunch of code in a web view • It does not compromise on performance
TRULY NATIVE • Concurrent, no GIL, multi-core processors and GCD fully supported • Statically compiled to machine code (MacRuby uses JIT, which is not allowed on devices) • Full App Store compliance • Automatic memory management
LIMITATIONS • require - cannot require files at runtime, they need to be available at build-time • eval - not supported in static compilation • define_method - not supported in static compilation • Proc#binding - removed because of performance issue • Regular Ruby gems do not work
LIMITATIONS • No auto-complete - lots of copy-pasting Objective-C method names from docs and converting to Ruby • No stdlib • Debugger isn't awesome yet, but it's coming
BASE64 • Objective-C - find and download a Base64 library, add it as a dependency, figure out how to use it, encode your string... • Ruby ["string"].pack("m")
REPL • CMD + click on UI element from the simulator and make live changes to objects - selected object becomes self in console • Closest thing in XCode is setting a breakpoint
FUNCTIONAL VIEW AND CONTROLLER TESTING • Uses the functionality in Apple’s UIAutomation framework describe "The Timer view controller" do tests TimerController it "has a timer label" do view('Tap to start').should.not == nil end end
DEPENDENCIES • CocoaPods - Bundler-like dependency definition, automatically vendors and requires third-party libraries at build time app.pods do dependency "JSONKit" dependency "AFNetworking" dependency "libPusher" end
BUBBLEWRAP • Device • App • JSON • Notification Center • Observers • Location • HTTP • EM Reactor • Time • ..... fork and contribute! bubblewrap.io A collection of (tested) helpers and wrappers used to wrap CocoaTouch code and provide more Ruby like APIs.
GETTING STARTED • Buy license for $199 • $99 annual renewal • Renewal not required for continued functionality • iOS developer license from Apple ($99/year)