SlideShare a Scribd company logo
Ruby’izing iOS
   Development


Amit Kumar
About me




• Ruby’ist
• Consultant: Tata Consultancy Services Ltd
• Github: toamitkumar
• Twitter: toamit
• toamitkumar.github.com
Ruby'izing iOS development
Released in May, 2012
Released in May, 2012
RubyMotion
RubyMotion

revolutionary toolchain for native iOS application development using Ruby language
RubyMotion

revolutionary toolchain for native iOS application development using Ruby language




                                                neighbor's envy coder’s delight; happiness;
A What ??
A What ??
A What ??

Fork of MacRuby
A What ??

Fork of MacRuby          Compiles into optimized machine code
A What ??

Fork of MacRuby                                  Compiles into optimized machine code




Automatic object memory allocation and reclaim
A What ??

Fork of MacRuby                                  Compiles into optimized machine code




Automatic object memory allocation and reclaim
A What ??

Fork of MacRuby                                  Compiles into optimized machine code




Automatic object memory allocation and reclaim



Compiles the interfaces built in IB of XCode
A What ??

Fork of MacRuby                                  Compiles into optimized machine code




Automatic object memory allocation and reclaim



Compiles the interfaces built in IB of XCode
A What ??

Fork of MacRuby                                      Compiles into optimized machine code




Automatic object memory allocation and reclaim



Compiles the interfaces built in IB of XCode



Ruby-runtime tightly integrated with Obj-C runtime
A What ??

Fork of MacRuby                                      Compiles into optimized machine code




Automatic object memory allocation and reclaim



Compiles the interfaces built in IB of XCode



Ruby-runtime tightly integrated with Obj-C runtime



 Same ancestor as Obj-C
A What ??
A What ??

Fork of MacRuby                                      Compiles into optimized machine code




Automatic object memory allocation and reclaim



Compiles the interfaces built in IB of XCode



Ruby-runtime tightly integrated with Obj-C runtime



 Same ancestor as Obj-C
A What ??

Fork of MacRuby                                      Compiles into optimized machine code




Automatic object memory allocation and reclaim



Compiles the interfaces built in IB of XCode



Ruby-runtime tightly integrated with Obj-C runtime



 Same ancestor as Obj-C                          Object can be shared with no performance cost
Motion Runtime
Motion Runtime
Motion Runtime
Motion Runtime




  Shared Runtime
Motion Runtime




  Shared Runtime
Motion Runtime




  Shared Runtime
Motion Runtime




Foundation Framework
  (NSObject - Kernel)



      Shared Runtime
Motion Runtime




Foundation Framework
  (NSObject - Kernel)



      Shared Runtime
Motion Runtime




Foundation Framework
  (NSObject - Kernel)



      Shared Runtime
Myths
Myths


Can I code using RubyMotion without the pain to learn Cocoa Framework ?
Myths


Can I code using RubyMotion without the pain to learn Cocoa Framework ?




PhoneGap like tools are much easier to learn what advantage do I get with RubyMotion ?
Myths


Can I code using RubyMotion without the pain to learn Cocoa Framework ?




PhoneGap like tools are much easier to learn what advantage do I get with RubyMotion ?


   Pros:
Myths


Can I code using RubyMotion without the pain to learn Cocoa Framework ?




PhoneGap like tools are much easier to learn what advantage do I get with RubyMotion ?


   Pros:
    - Very easy to get started; as we all know HTML/JS/CSS
Myths


Can I code using RubyMotion without the pain to learn Cocoa Framework ?




PhoneGap like tools are much easier to learn what advantage do I get with RubyMotion ?


   Pros:
    - Very easy to get started; as we all know HTML/JS/CSS

   Cons:
Myths


Can I code using RubyMotion without the pain to learn Cocoa Framework ?




PhoneGap like tools are much easier to learn what advantage do I get with RubyMotion ?


   Pros:
    - Very easy to get started; as we all know HTML/JS/CSS

   Cons:
    - Its a bridge that makes native api calls
Myths


Can I code using RubyMotion without the pain to learn Cocoa Framework ?




PhoneGap like tools are much easier to learn what advantage do I get with RubyMotion ?


   Pros:
    - Very easy to get started; as we all know HTML/JS/CSS

   Cons:
    - Its a bridge that makes native api calls
    - Runs in single thread of UIWebView which is painfully slow
Myths


Can I code using RubyMotion without the pain to learn Cocoa Framework ?




PhoneGap like tools are much easier to learn what advantage do I get with RubyMotion ?


   Pros:
    - Very easy to get started; as we all know HTML/JS/CSS

   Cons:
    - Its a bridge that makes native api calls
    - Runs in single thread of UIWebView which is painfully slow
    - Limited support of direct access to native APIs
Myths


Can I code using RubyMotion without the pain to learn Cocoa Framework ?




PhoneGap like tools are much easier to learn what advantage do I get with RubyMotion ?


   Pros:
    - Very easy to get started; as we all know HTML/JS/CSS

   Cons:
    - Its a bridge that makes native api calls
    - Runs in single thread of UIWebView which is painfully slow
    - Limited support of direct access to native APIs
    - Debugging becomes extremely difficult when you make native api calls
Download & Install




http://sites.fastspring.com/hipbyte/product/rubymotion
The ‘motion’ command
The ‘motion’ command
The ‘motion’ command
The ‘motion’ command
The ‘motion’ command
The ‘motion’ command




Protip: Forcing update to a particular version:
The ‘motion’ command




Protip: Forcing update to a particular version:
The ‘motion’ command




Protip: Forcing update to a particular version:

sudo motion update --force-version=1.2
The ‘motion’ command
The famous ‘Rake’
The famous ‘Rake’
The famous ‘Rake’
The famous ‘Rake’
The famous ‘Rake’
The famous ‘Rake’
Configuration ‘options’
Configuration ‘options’
Configuration ‘options’
Configuration ‘options’
Configuration ‘options’
Configuration ‘options’
Configuration ‘options’
Pro-tip: Other configuration options
Configuration ‘options’
Pro-tip: Other configuration options




app.file_dependencies ‘app/controllers/curves_controller.rb’ => ‘app/controllers/main_controller.rb’
Configuration ‘options’
Pro-tip: Other configuration options




app.file_dependencies ‘app/controllers/curves_controller.rb’ => ‘app/controllers/main_controller.rb’




app.vendor_project
The Soul


Console REPL - Read Evaluate Print Loop
The Soul


Console REPL - Read Evaluate Print Loop




     You feel in-control
The Soul


Console REPL - Read Evaluate Print Loop




     You feel in-control
The Soul


                     Console REPL - Read Evaluate Print Loop




                           You feel in-control



An excellent in-browser demo of REPL:  https://www.pieceable.com/rubymotion-console
Build Process
Build Process




COMPILING
Build Process




COMPILING               LINKING
Build Process




COMPILING               LINKING




PACKAGING
Build Process




COMPILING               LINKING




PACKAGING          CODE SIGN
Testing your code
Testing your code


Like Rails, RubyMotion comes bundled with ‘RSpec’ like framework ‘MacBacon’
Testing your code


Like Rails, RubyMotion comes bundled with ‘RSpec’ like framework ‘MacBacon’

    <motion_root>/spec/main_spec.rb
Testing your code


Like Rails, RubyMotion comes bundled with ‘RSpec’ like framework ‘MacBacon’

    <motion_root>/spec/main_spec.rb
    $ rake spec
Testing your code


Like Rails, RubyMotion comes bundled with ‘RSpec’ like framework ‘MacBacon’

    <motion_root>/spec/main_spec.rb
    $ rake spec




‘MacBacon’ has almost all ‘syntactic sugar’ that you are accustomed in RSpec:
Testing your code


Like Rails, RubyMotion comes bundled with ‘RSpec’ like framework ‘MacBacon’

    <motion_root>/spec/main_spec.rb
    $ rake spec




‘MacBacon’ has almost all ‘syntactic sugar’ that you are accustomed in RSpec:
 - Assertions
Testing your code


Like Rails, RubyMotion comes bundled with ‘RSpec’ like framework ‘MacBacon’

    <motion_root>/spec/main_spec.rb
    $ rake spec




‘MacBacon’ has almost all ‘syntactic sugar’ that you are accustomed in RSpec:
 - Assertions
 - Matchers
Testing your code


Like Rails, RubyMotion comes bundled with ‘RSpec’ like framework ‘MacBacon’

    <motion_root>/spec/main_spec.rb
    $ rake spec




‘MacBacon’ has almost all ‘syntactic sugar’ that you are accustomed in RSpec:
 - Assertions
 - Matchers
 - before/after blocks
Testing your code


Like Rails, RubyMotion comes bundled with ‘RSpec’ like framework ‘MacBacon’

    <motion_root>/spec/main_spec.rb
    $ rake spec




‘MacBacon’ has almost all ‘syntactic sugar’ that you are accustomed in RSpec:
 - Assertions
 - Matchers
 - before/after blocks

View testing:
Testing your code


Like Rails, RubyMotion comes bundled with ‘RSpec’ like framework ‘MacBacon’

    <motion_root>/spec/main_spec.rb
    $ rake spec




‘MacBacon’ has almost all ‘syntactic sugar’ that you are accustomed in RSpec:
 - Assertions
 - Matchers
 - before/after blocks

View testing:
 - Loading the nib/xib/storyboard file
Continuos Integration


              Jenkins setup on mac-mini          App Store


 WebHook                                  Push




Setup for local deployment and testing
Using External Libraries
Using External Libraries




RubyGems
Using External Libraries



                     Objective-C
RubyGems
                       Project
Using External Libraries



                      Objective-C
RubyGems
                        Project




Native-C
Using External Libraries



                      Objective-C
RubyGems
                        Project




Native-C              CocoaPods
RubyGems
RubyGems

Normal RubyGems won’t work
RubyGems

Normal RubyGems won’t work




Motion::Project::App.setup do |app|
  # Load files from gem
end
RubyGems

Normal RubyGems won’t work




Motion::Project::App.setup do |app|
  # Load files from gem
end




Use Bundler
RubyGems

Normal RubyGems won’t work




Motion::Project::App.setup do |app|
  # Load files from gem
end




                                 source :rubygems

                                 gem 'rake'               require ‘bundler’
Use Bundler                      gem 'bubble-wrap'        Bundler.require
                                 gem 'motion-cocoapods'
                                 gem 'motion-redgreen'           Rakefile
                                         Gemfile
RubyGems contd...
RubyGems contd...
Bubblewrap

teacup

sugarcube

formotion

Nitron

motion-redgreen

motion-logger

MotionModel

NativeJSBridge

SegmentTab
Using Obj-C code
Using Obj-C code

Statically Compiled

 app.vendor_project(
   “vendor/project-name”, #should have both .h and .m file
   :static
 )
Using Obj-C code

Statically Compiled

 app.vendor_project(
   “vendor/project-name”, #should have both .h and .m file
   :static
 )
Using Obj-C code

Statically Compiled

 app.vendor_project(
   “vendor/project-name”, #should have both .h and .m file
   :static
 )

XCode project:

  app.vendor_project(
   “vendor/project-name”,
   :xcode,
   :xcodeproj => “project-name.xcodeproj”,
   :target => “project-name”,
   :products => [“libproject-name.a”],
   :headers_dir => “project-name”
 )
Using native C code
Using native C code

         Basic Types in C                            Ruby data types

(bool, char, int, long, float, double)       (true/false, Fixnum, Bignum, Float)
Using native C code

         Basic Types in C                            Ruby data types

(bool, char, int, long, float, double)       (true/false, Fixnum, Bignum, Float)




  C Complex Data Structures
Using native C code

         Basic Types in C                            Ruby data types

(bool, char, int, long, float, double)       (true/false, Fixnum, Bignum, Float)




                                            No corresponding Ruby Data
  C Complex Data Structures
                                            Types
Using native C code

         Basic Types in C                            Ruby data types

(bool, char, int, long, float, double)       (true/false, Fixnum, Bignum, Float)




                                            No corresponding Ruby Data
                                            Types




  C Complex Data Structures
Using native C code

         Basic Types in C                                        Ruby data types

(bool, char, int, long, float, double)                   (true/false, Fixnum, Bignum, Float)




                                                        No corresponding Ruby Data
                                                        Types




  C Complex Data Structures
                                        BridgeSupport
Using native C code

         Basic Types in C                                        Ruby data types

(bool, char, int, long, float, double)                   (true/false, Fixnum, Bignum, Float)




                                                        No corresponding Ruby Data
                                                        Types




  C Complex Data Structures                                        RubyMotion
                                        BridgeSupport
CocoaPods
CocoaPods
is a dependency manager for Obj-C projects
CocoaPods
is a dependency manager for Obj-C projects

sudo gem install cocoapods
CocoaPods
is a dependency manager for Obj-C projects

sudo gem install cocoapods
pod setup # this may not be required for everyone, it never worked for me
CocoaPods
is a dependency manager for Obj-C projects

sudo gem install cocoapods
pod setup # this may not be required for everyone, it never worked for me

https://github.com/CocoaPods/Specs - lists all the pods
CocoaPods
is a dependency manager for Obj-C projects

sudo gem install cocoapods
pod setup # this may not be required for everyone, it never worked for me

https://github.com/CocoaPods/Specs - lists all the pods


It has been integrated with RubyMotion which comes as a gem
CocoaPods
is a dependency manager for Obj-C projects

sudo gem install cocoapods
pod setup # this may not be required for everyone, it never worked for me

https://github.com/CocoaPods/Specs - lists all the pods


It has been integrated with RubyMotion which comes as a gem


sudo gem install motion-cocoapods
CocoaPods
is a dependency manager for Obj-C projects

sudo gem install cocoapods
pod setup # this may not be required for everyone, it never worked for me

https://github.com/CocoaPods/Specs - lists all the pods


It has been integrated with RubyMotion which comes as a gem


sudo gem install motion-cocoapods

Include it in your Rakefile:
require ‘moion-cocoapods’
Motion::Project::App.setup do |app|
 # ...
 app.pods do
  dependency 'JSONKit'
  dependency 'iActiveRecord'
 end
end
Long way to go !
Long way to go !



RM is only ~4 months old
Long way to go !



RM is only ~4 months old




Something it lacks:

 - Debugger (but REPL kind of makes it easy)
 - Some dynamic code doesn’t work (but hey !!!)
RM applications on AppStore
RM applications on AppStore


Everclip
RM applications on AppStore


Everclip

Cabify
RM applications on AppStore


Everclip

Cabify




Survey
RM applications on AppStore


Everclip

Cabify




Survey

http://signup.bigdayreminder.com/
RM applications on AppStore


Everclip

Cabify




Survey

http://signup.bigdayreminder.com/

http://jukely.com/
THANK YOU
One more thing !


15% discount
 toamitkumar@gmail.com

More Related Content

PDF
Bitter Java, Sweeten with JRuby
PDF
TorqueBox
PDF
The Future of Cross-Platform is Native
PDF
Making everything better with OSGi - a happy case study in building a really ...
PDF
Ror Seminar With agilebd.org on 23 Jan09
PPTX
Codestrong 2012 breakout session exploring the new titanium command line in...
ODP
3978 Why is Java so different... A Session for Cobol/PLI/Assembler Developers
KEY
Your fist RubyMotion Application
Bitter Java, Sweeten with JRuby
TorqueBox
The Future of Cross-Platform is Native
Making everything better with OSGi - a happy case study in building a really ...
Ror Seminar With agilebd.org on 23 Jan09
Codestrong 2012 breakout session exploring the new titanium command line in...
3978 Why is Java so different... A Session for Cobol/PLI/Assembler Developers
Your fist RubyMotion Application

What's hot (20)

PDF
Why ClassforName Sucks - BJ Hargrave
KEY
Ruby on Rails Training - Module 1
PDF
Rails On Spring
PDF
JavaOne 2012 CON3978 Scripting Languages on the JVM
PPTX
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
PPTX
Scalable Real Time Chat (Text, Audio, Video) - Implemented using XMPP
PPTX
Visual COBOL Development for Unix and Java
PDF
JavaOne 2012 CON 3961 Innovative Testing Techniques Using Bytecode Instrument...
PDF
Cordova: APIs and instruments
PDF
How To Access Code In Large w/ Vim
PDF
From java-to-ruby-book-summary
PDF
A Java Implementer's Guide to Better Apache Spark Performance
PDF
Open Social Summit Korea
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
PPTX
COBOL deployment to .NET or JVM
PDF
Testing Ember Apps
PPTX
REST Development made Easy with ColdFusion Aether
PPT
Java, Ruby & Rails
PDF
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
PDF
Why would a Java shop want to use Ruby?
Why ClassforName Sucks - BJ Hargrave
Ruby on Rails Training - Module 1
Rails On Spring
JavaOne 2012 CON3978 Scripting Languages on the JVM
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Scalable Real Time Chat (Text, Audio, Video) - Implemented using XMPP
Visual COBOL Development for Unix and Java
JavaOne 2012 CON 3961 Innovative Testing Techniques Using Bytecode Instrument...
Cordova: APIs and instruments
How To Access Code In Large w/ Vim
From java-to-ruby-book-summary
A Java Implementer's Guide to Better Apache Spark Performance
Open Social Summit Korea
Top 10 Dying Programming Languages in 2020 | Edureka
COBOL deployment to .NET or JVM
Testing Ember Apps
REST Development made Easy with ColdFusion Aether
Java, Ruby & Rails
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Why would a Java shop want to use Ruby?
Ad

Viewers also liked (6)

KEY
404 not found
PDF
Fibered rails
KEY
Micro-Blogging for The Enterprise (MongoDB)
KEY
Ruby conf'11
PDF
Digital Transformation with 2 Speed IT & Agile Scrum
PDF
Bimodal IT - Mode 2 Evolution Roadmap v12
404 not found
Fibered rails
Micro-Blogging for The Enterprise (MongoDB)
Ruby conf'11
Digital Transformation with 2 Speed IT & Agile Scrum
Bimodal IT - Mode 2 Evolution Roadmap v12
Ad

Similar to Ruby'izing iOS development (20)

PDF
Write cross platform native apps in Ruby
PDF
RubyMotion: Put your Dreams in Motion with Ruby
PDF
RubyMotion
PDF
[Srijan Wednesday Webinars] Building Full-Fledged Native Apps Using RubyMotion
PDF
Rubymotion inspect 2014_review
PDF
MacRuby & RubyMotion - Madridrb May 2012
PDF
RubyMotion Introduction
PDF
RubyMotion: Hack Your iOS App Like Never Before
PDF
Building iOS Apps With RubyMotion
PDF
MacRuby & HotCocoa
PDF
RubyMotion Gets A Cool New Friend: mruby on iOS
PDF
TryRubyMotion
KEY
MacRuby: What is it? and why should you care?
PDF
Mac ruby deployment
PDF
RubyならMacでしょう
PDF
ruby-cocoa
PDF
ruby-cocoa
PDF
RailsConf 2013: RubyMotion
PDF
A brief intro to RubyMotion
KEY
RubyMotion Introduction
Write cross platform native apps in Ruby
RubyMotion: Put your Dreams in Motion with Ruby
RubyMotion
[Srijan Wednesday Webinars] Building Full-Fledged Native Apps Using RubyMotion
Rubymotion inspect 2014_review
MacRuby & RubyMotion - Madridrb May 2012
RubyMotion Introduction
RubyMotion: Hack Your iOS App Like Never Before
Building iOS Apps With RubyMotion
MacRuby & HotCocoa
RubyMotion Gets A Cool New Friend: mruby on iOS
TryRubyMotion
MacRuby: What is it? and why should you care?
Mac ruby deployment
RubyならMacでしょう
ruby-cocoa
ruby-cocoa
RailsConf 2013: RubyMotion
A brief intro to RubyMotion
RubyMotion Introduction

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
cuic standard and advanced reporting.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
A Presentation on Artificial Intelligence
Review of recent advances in non-invasive hemoglobin estimation
cuic standard and advanced reporting.pdf
Spectral efficient network and resource selection model in 5G networks
Building Integrated photovoltaic BIPV_UPV.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Understanding_Digital_Forensics_Presentation.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Mobile App Security Testing_ A Comprehensive Guide.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Chapter 3 Spatial Domain Image Processing.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Modernizing your data center with Dell and AMD
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
A Presentation on Artificial Intelligence

Ruby'izing iOS development

Editor's Notes