Introduction to RubyMotion (v2.0)
The Cool Way to Build iOS Apps
By Gant Laborde
@GantLaborde
Avid Rubyist and generally immature guy
Co-Founder of IconoclastLabs.com
Core-contributor to RubyMotion/InfiniteRed/Clearsight Studio
Author of Numerous RubyMotion projects and Pull Requests
Author of the book RubyMotion App Development
by Packt Publishing.
RubyMotion
RubyMotion - Wat?
/ˈro͞obē-mōSHən/
noun trademark1. A proprietary toolchain, created by HipByte SPRL, for developing native iOS, OS X, and Android applications on mobile devices and computers by statically compiling the Ruby programming language.
OR
Apps the Ruby Way
Quick Example
Objective-C button tap
[button addTarget:self action:@selector(buttonTapped:)
forControlEvents: UIControlEventTouchUpInside];
// Elsewhere
- (void)buttonTapped:(id)sender {
self.view.backgroundColor = [UIColor redColor];
}
RubyMotion button tap
button.addTarget(self, action:'button_tapped', forControlEvents:UIControlEventTouchUpInside)
# Elsewhere
def button_tapped
self.view.backgroundColor = UIColor.redColor
end
Better Example
Objective-C button tap
[button addTarget:self action:@selector(buttonTapped:)
forControlEvents: UIControlEventTouchUpInside];
// Elsewhere
- (void)buttonTapped:(id)sender {
self.view.backgroundColor = [UIColor redColor];
}
RubyMotion button tap (with RedPotion gem)
find(button).on(:tap) do
self.view.backgroundColor = color.red
end
lessLike:objectiveC:
and more like_ruby
- Clay Allsopp
What about Swift!?
Swift is great ... but.
Ruby is Evolving
Ruby is Chosen
Ruby is Everywhere
What's So Great About RubyMotion?
In my opinion
- Gems and Community
- Editor Independence
- Testing!
- Readability
- Natively Compiled
- The REPL
RubyMotion Analogy
RubyMotion is to Objective-C
As Coffeescript is to Javascript
... plus RMQ is kind of like jQuery
... plus MacBacon has spec tests like Jasmine would
... plus the REPL lets you live-modify like developer tools
... plus CDQ gives you a DB like CouchDB would
... plus it compiles and obfuscates your final codebase
... OK, this analogy got out of control
Let's Look At Code!
- Classic - Hello World
- Full App - Ruby Trivia
- Games!
Hello WorlD App Delegate
class AppDelegate < PM::Delegate
def on_load(app, options)
open HelloWorldController.new(nav_bar: true)
end
end
Hello WorlD
class HelloWorldController < PM::Screen
def on_load
p "Hai"
end
end
SImply prints "Hai"
We can add a label to the screen just as easily.
Code Example #2
Ruby Trivia
- RedPotion
- BubbleWrap
- motion-concierge
- and more ...
Now using Redpotion
Tests!
Let's look at the code!
Code Example #3
Game Dev
Totally Tacos!
A game made in one day!
Alternatives?
Native
Stuck on Language
No Cross Platform
Phonegap
Slower
Insecure
Half-assed
Other?
xamarin
Facebook REACT NATIVE
Professional stuffs
It's a great way to make money!
Professional stuffs
Fandor
Fandor wanted to make it easy for people to discover and watch handpicked, award-winning movies of all lengths and genres, from the world’s most respected filmmakers. They aim to create a global community of film lovers and makers connected by meaningful and entertaining cinematic experiences as well as deliver a fair revenue share to filmmakers and distributors.
Professional stuffs
Envoy
Professional stuffs
Crossover health
Introduction to RubyMotion
By Gant Laborde
Introduction to RubyMotion
- 2,801