Ruby'izing iOS development
Upcoming SlideShare
Loading in...5
×
 

Ruby'izing iOS development

on

  • 848 views

 

Statistics

Views

Total Views
848
Views on SlideShare
844
Embed Views
4

Actions

Likes
3
Downloads
24
Comments
0

3 Embeds 4

http://coderwall.com 2
http://www.hanrss.com 1
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Ruby'izing iOS development Ruby'izing iOS development Presentation Transcript

  • Ruby’izing iOS DevelopmentAmit Kumar
  • About me• Ruby’ist• Consultant: Tata Consultancy Services Ltd• Github: toamitkumar• Twitter: toamit• toamitkumar.github.com
  • Released in May, 2012
  • Released in May, 2012
  • RubyMotion
  • RubyMotionrevolutionary toolchain for native iOS application development using Ruby language
  • RubyMotionrevolutionary toolchain for native iOS application development using Ruby language neighbors 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 codeAutomatic object memory allocation and reclaim
  • A What ??Fork of MacRuby Compiles into optimized machine codeAutomatic object memory allocation and reclaim
  • A What ??Fork of MacRuby Compiles into optimized machine codeAutomatic object memory allocation and reclaimCompiles the interfaces built in IB of XCode
  • A What ??Fork of MacRuby Compiles into optimized machine codeAutomatic object memory allocation and reclaimCompiles the interfaces built in IB of XCode
  • A What ??Fork of MacRuby Compiles into optimized machine codeAutomatic object memory allocation and reclaimCompiles the interfaces built in IB of XCodeRuby-runtime tightly integrated with Obj-C runtime
  • A What ??Fork of MacRuby Compiles into optimized machine codeAutomatic object memory allocation and reclaimCompiles the interfaces built in IB of XCodeRuby-runtime tightly integrated with Obj-C runtime Same ancestor as Obj-C
  • A What ??
  • A What ??Fork of MacRuby Compiles into optimized machine codeAutomatic object memory allocation and reclaimCompiles the interfaces built in IB of XCodeRuby-runtime tightly integrated with Obj-C runtime Same ancestor as Obj-C
  • A What ??Fork of MacRuby Compiles into optimized machine codeAutomatic object memory allocation and reclaimCompiles the interfaces built in IB of XCodeRuby-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 RuntimeFoundation Framework (NSObject - Kernel) Shared Runtime
  • Motion RuntimeFoundation Framework (NSObject - Kernel) Shared Runtime
  • Motion RuntimeFoundation Framework (NSObject - Kernel) Shared Runtime
  • Myths
  • MythsCan I code using RubyMotion without the pain to learn Cocoa Framework ?
  • MythsCan 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 ?
  • MythsCan 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:
  • MythsCan 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
  • MythsCan 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:
  • MythsCan 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
  • MythsCan 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
  • MythsCan 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
  • MythsCan 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 & Installhttp://sites.fastspring.com/hipbyte/product/rubymotion
  • The ‘motion’ command
  • The ‘motion’ command
  • The ‘motion’ command
  • The ‘motion’ command
  • The ‘motion’ command
  • The ‘motion’ commandProtip: Forcing update to a particular version:
  • The ‘motion’ commandProtip: Forcing update to a particular version:
  • The ‘motion’ commandProtip: 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 optionsapp.file_dependencies ‘app/controllers/curves_controller.rb’ => ‘app/controllers/main_controller.rb’
  • Configuration ‘options’Pro-tip: Other configuration optionsapp.file_dependencies ‘app/controllers/curves_controller.rb’ => ‘app/controllers/main_controller.rb’app.vendor_project
  • The SoulConsole REPL - Read Evaluate Print Loop
  • The SoulConsole REPL - Read Evaluate Print Loop You feel in-control
  • The SoulConsole REPL - Read Evaluate Print Loop You feel in-control
  • The Soul Console REPL - Read Evaluate Print Loop You feel in-controlAn excellent in-browser demo of REPL:  https://www.pieceable.com/rubymotion-console
  • Build Process
  • Build ProcessCOMPILING
  • Build ProcessCOMPILING LINKING
  • Build ProcessCOMPILING LINKINGPACKAGING
  • Build ProcessCOMPILING LINKINGPACKAGING CODE SIGN
  • Testing your code
  • Testing your codeLike Rails, RubyMotion comes bundled with ‘RSpec’ like framework ‘MacBacon’
  • Testing your codeLike Rails, RubyMotion comes bundled with ‘RSpec’ like framework ‘MacBacon’ <motion_root>/spec/main_spec.rb
  • Testing your codeLike Rails, RubyMotion comes bundled with ‘RSpec’ like framework ‘MacBacon’ <motion_root>/spec/main_spec.rb $ rake spec
  • Testing your codeLike 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 codeLike 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 codeLike 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 codeLike 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 codeLike 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 blocksView testing:
  • Testing your codeLike 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 blocksView testing: - Loading the nib/xib/storyboard file
  • Continuos Integration Jenkins setup on mac-mini App Store WebHook PushSetup for local deployment and testing
  • Using External Libraries
  • Using External LibrariesRubyGems
  • Using External Libraries Objective-CRubyGems Project
  • Using External Libraries Objective-CRubyGems ProjectNative-C
  • Using External Libraries Objective-CRubyGems ProjectNative-C CocoaPods
  • RubyGems
  • RubyGemsNormal RubyGems won’t work
  • RubyGemsNormal RubyGems won’t workMotion::Project::App.setup do |app| # Load files from gemend
  • RubyGemsNormal RubyGems won’t workMotion::Project::App.setup do |app| # Load files from gemendUse Bundler
  • RubyGemsNormal RubyGems won’t workMotion::Project::App.setup do |app| # Load files from gemend 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...BubblewrapteacupsugarcubeformotionNitronmotion-redgreenmotion-loggerMotionModelNativeJSBridgeSegmentTab
  • Using Obj-C code
  • Using Obj-C codeStatically Compiled app.vendor_project( “vendor/project-name”, #should have both .h and .m file :static )
  • Using Obj-C codeStatically Compiled app.vendor_project( “vendor/project-name”, #should have both .h and .m file :static )
  • Using Obj-C codeStatically 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
  • CocoaPodsis a dependency manager for Obj-C projects
  • CocoaPodsis a dependency manager for Obj-C projectssudo gem install cocoapods
  • CocoaPodsis a dependency manager for Obj-C projectssudo gem install cocoapodspod setup # this may not be required for everyone, it never worked for me
  • CocoaPodsis a dependency manager for Obj-C projectssudo gem install cocoapodspod setup # this may not be required for everyone, it never worked for mehttps://github.com/CocoaPods/Specs - lists all the pods
  • CocoaPodsis a dependency manager for Obj-C projectssudo gem install cocoapodspod setup # this may not be required for everyone, it never worked for mehttps://github.com/CocoaPods/Specs - lists all the podsIt has been integrated with RubyMotion which comes as a gem
  • CocoaPodsis a dependency manager for Obj-C projectssudo gem install cocoapodspod setup # this may not be required for everyone, it never worked for mehttps://github.com/CocoaPods/Specs - lists all the podsIt has been integrated with RubyMotion which comes as a gemsudo gem install motion-cocoapods
  • CocoaPodsis a dependency manager for Obj-C projectssudo gem install cocoapodspod setup # this may not be required for everyone, it never worked for mehttps://github.com/CocoaPods/Specs - lists all the podsIt has been integrated with RubyMotion which comes as a gemsudo gem install motion-cocoapodsInclude it in your Rakefile:require ‘moion-cocoapods’Motion::Project::App.setup do |app| # ... app.pods do dependency JSONKit dependency iActiveRecord endend
  • Long way to go !
  • Long way to go !RM is only ~4 months old
  • Long way to go !RM is only ~4 months oldSomething 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 AppStoreEverclip
  • RM applications on AppStoreEverclipCabify
  • RM applications on AppStoreEverclipCabifySurvey
  • RM applications on AppStoreEverclipCabifySurveyhttp://signup.bigdayreminder.com/
  • RM applications on AppStoreEverclipCabifySurveyhttp://signup.bigdayreminder.com/http://jukely.com/
  • THANK YOU
  • One more thing !15% discount toamitkumar@gmail.com