SlideShare a Scribd company logo
RoR to RubyMotion
Writing Your First iOS App
With RubyMotion
Michael Denomy
BostonMotion User Group
June 25, 2013
About Me
• Tech Lead at Cyrus Innovation
- Agile web consultancy with offices in New
York and Boston
- http://www.cyrusinnovation.com
• Agile and XP practitioner since 2004
- Passionate about TDD and pairing
• mdenomy on twitter and github
• Blog at www.mdenomy.wordpress.com
Goals
• Capture my experiences getting started
with RubyMotion
- Help someone else along
- Get ideas for where to go next
• Target Audience
- Developers familiar with Ruby on Rails
- Little to no previous experience with iOS
- Desire to learn
• Some talk, some code
The Vision
MVC
Ruby
The Reality initWithNibName?
UIControlEventTouchUpInside?
What’s a Nib?
More Cold Hard Facts
• RubyMotion is not free
- $199.99
- No trial, but 30 day money back
- There is a student discount program
• iOS Developer Program is not free
- $99 / year
- Required to deploy to devices and distribute
via AppStore
• You will need to understand iOS SDK
- iOS documentation is difficult to navigate
It Gets Better
It Gets Better
Good Stuff
• Growing community with lots of online
resources
• More and more gems appearing that
provide a Rails-like experience
• Free to use the tools you like
- Sublime plug in for RubyMotion has code
completion and rake shortcuts
https://github.com/haraken3/
SublimeRubyMotionBuilder
MVC in iOS
• MVC is MVC right?
• No “convention over configuration”
- Have to wire things up manually
• Slightly different terminology that Rails
UIViewControllers
• Controller receives actions from the
framework (e.g. view loaded) and the
user (e.g. button pressed)
- Interacts with Models and View
• UIViewControllers you need to know
- UINavigationController
- UITabBarController
- UIViewController
- UITableViewController
Models
• Models are PORO’s in RubyMotion
• Support built-in for
- attr_accessor
- attr_reader
- attr_writer
• Possible to serialize/deserialize data
using NSCoder and NSKeyedArchiver
- Looked for other options to support storage
and relationships
Views
• UIView is a base class
• Buttons, labels, date pickers, etc., all
inherit from UIView
• Views can have subviews
- Simplifies screen layout and allows re-use
Let’s Look at Some Code
• Basic Navigation
- Application Delegate
- Root View Controller
- UITabBarController
- UIViewControllers
MyWines App
• I enjoy the occasional glass of wine.
• I would like to have a way to track the
wines I like and prices I've paid for them
- Record tasting notes
- Record purchases and price info
- Search for wine by name/producer
- Save to Favorites
- Save label picture
• Spoiler alert
- I have done next to nothing to style the app
Sketch It Out
It’s a lot cheaper and faster to iterate at this
level than in code
What Tools Did I Choose
• Bundler - Simplify dependencies
• ProMotion - Screen development and workflow
• Formotion - Entry/edit forms
• MotionModel - Models and relations
• Teacup - Styling DSL
• Sugarcube - UI extensions
• BubbleWrap - I used it for camera, but lots more
(JSON, HTTP, RSS, Location, Audio, Video)
• MotionAwesome - Buttons and icons
More at http://rubymotion-wrappers.com/
ProMotion
• Simplifies screen development
• Support for table screens
- Easily search for table entries
• Helpers for tab and navbar controllers
Formotion
• Easily create forms
for entry/edit
• Integrates with
ProMotion
• Support For
- text
- dates
- sliders
- check boxes
- and many more
MotionModel
• Wanted something like ActiveRecord
• Chose MotionModel gem
- Lightweight
- Feels Railsy
‣ Validations
‣ ActiveRecord-like syntax
‣ Relations
- Serialization / deserialization support
- Actively maintained
- Formotion support(turned out not to matter)
Teacup
• Layout and style
your app in a DSL
• Frees you up from
layout of screens in
XCode
• Allows you to keep
your views a lot
cleaner
• Hierarchical and
supports variables
Sugarcube
• Tons of helpful ‘syntactic sugar’ extensions
to make your development easier
- conversion of hex color codes to UIColor
- alert and action dialogs
- symbol to iOS, e.g.,
‣ :touch.uicontrolevent becomes UIControlEventTouchUpInside
- array helpers
- hash to object conversions
BubbleWrap
• Amazing set of tools for
- HTTP
- JSON
- RSS
- Camera
- Location
- Alert boxes
- REPL support
• Just using it for the camera in my app
MotionAwesome
• Great set of icons and buttons
• Based on FontAwesome
• So far only used it to create a camera
button using a camera icon
Deploying to Device
• Must be in Apple Developer Program
- $99/year
• Get provisioning and developer
certificates
• Deploy using rake
- rake device
- Make sure to quit iTunes and Image Capture
• Can’t do some things with simulator
- e.g. Camera
Where Do I Go Next
• Better use of views and subviews
- As app evolves will have more common
controls/groups -> re-use
- Easier to lay out due to relative positioning
used in subviews
• Better/more styling
- Will require more understanding of iOS
• Persist images to file system
• Do more with models
- Averages, filtering, etc
Where Do I Go Next
• Testing
- This was very much a spike, but as the app
evolves want to incorporate more automated
testing
- Tested the models, especially persistence and
validation since these were areas of risk
- Want to look at more integration testing
‣ motion-frank (maintained by Cyrus Innovation)
‣ motion-calabash
Questions I Still Have
• ProMotion is awesome, but I wonder if
down the road this paints me into a
corner
• Wild West of gems
- Will be interesting to see what ideas and
tools rise to the top
• How much iOS should I learn
- Interface Builder
- CoreData
Resources
• RubyMotion Developer Center
- http://www.rubymotion.com/developer-center/
• RubyMotion by Clay Allsop
- http://pragprog.com/book/carubym/rubymotion
• iOS Dev Center
- Tons of useful info, navigation is horrible
- https://developer.apple.com/devcenter/ios/index.action
- https://developer.apple.com/library/ios/#featuredarticles/
ViewControllerPGforiPhoneOS
• RubyMotion Wrappers and Libraries
- http://rubymotion-wrappers.com/
Questions
• Q&A
RoR to RubyMotion
Writing Your First iOS App
Michael Denomy
BostonMotion User Group
June 25, 2013

More Related Content

What's hot (20)

PPTX
Scaling with swagger
Tony Tam
 
PPTX
Developing in the Cloud
Ryan Cuprak
 
PPTX
Java script nirvana in netbeans [con5679]
Ryan Cuprak
 
PDF
React && React Native workshop
Stacy Goh
 
PDF
Flexible UI Components for a Multi-Framework World
Kevin Ball
 
PPTX
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Ryan Cuprak
 
PPTX
How NOT to get lost in the current JavaScript landscape
Radosław Scheibinger
 
PDF
Modern javascript
Kevin Ball
 
PDF
Fluxible
Taylor Lovett
 
PDF
Building Awesome APIs in Grails
clatimer
 
PDF
React Native Firebase Realtime Database + Authentication
Kobkrit Viriyayudhakorn
 
PPTX
Akka.net versus microsoft orleans
Bill Tulloch
 
PPTX
Angular Owin Katana TypeScript
Justin Wendlandt
 
PDF
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox
Kobkrit Viriyayudhakorn
 
PDF
Ransack, an Application Built on Ansible's API for Rackspace -- AnsibleFest N...
Paul Durivage
 
PDF
Introduction to Realm Mobile Platform
Christian Melchior
 
PPTX
Write retrogames in the web and add something more with Azure
Marco Parenzan
 
PDF
The Evolution of Airbnb's Frontend
Spike Brehm
 
PDF
Lambdaless and AWS CDK
MooYeol Lee
 
PDF
Realm Presentation
Phạm Khắc
 
Scaling with swagger
Tony Tam
 
Developing in the Cloud
Ryan Cuprak
 
Java script nirvana in netbeans [con5679]
Ryan Cuprak
 
React && React Native workshop
Stacy Goh
 
Flexible UI Components for a Multi-Framework World
Kevin Ball
 
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Ryan Cuprak
 
How NOT to get lost in the current JavaScript landscape
Radosław Scheibinger
 
Modern javascript
Kevin Ball
 
Fluxible
Taylor Lovett
 
Building Awesome APIs in Grails
clatimer
 
React Native Firebase Realtime Database + Authentication
Kobkrit Viriyayudhakorn
 
Akka.net versus microsoft orleans
Bill Tulloch
 
Angular Owin Katana TypeScript
Justin Wendlandt
 
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox
Kobkrit Viriyayudhakorn
 
Ransack, an Application Built on Ansible's API for Rackspace -- AnsibleFest N...
Paul Durivage
 
Introduction to Realm Mobile Platform
Christian Melchior
 
Write retrogames in the web and add something more with Azure
Marco Parenzan
 
The Evolution of Airbnb's Frontend
Spike Brehm
 
Lambdaless and AWS CDK
MooYeol Lee
 
Realm Presentation
Phạm Khắc
 

Similar to From Ruby on Rails to RubyMotion - Writing your First iOS App with RubyMotion (20)

PPTX
The future of web development write once, run everywhere with angular.js and ...
Mark Roden
 
PDF
The future of web development write once, run everywhere with angular js an...
Mark Leusink
 
PPTX
Wheel.js
baccigalupi
 
PPTX
AngularJS One Day Workshop
Shyam Seshadri
 
PPTX
A Smooth Transition to HTML5
Chris Bannon
 
PDF
Riding the Edge with Ember.js
aortbals
 
PPTX
UWP apps development - Part 2
Jiri Danihelka
 
PPTX
Step Into the Future – Blending AR, VR & AI with OutSystems
ShubhamSharma2528
 
PDF
Building mobile apps with PhoneGap and Backbone
Troy Miles
 
PPT
State of jQuery - AspDotNetStorefront Conference
dmethvin
 
PPTX
Single Page Application Development with backbone.js and Simple.Web
Chris Canal
 
PDF
Node.js 101
FITC
 
PPTX
Mvvm knockout vs angular
Basarat Syed
 
PDF
FITC - Bootstrap Unleashed
Rami Sayar
 
PPTX
ASP.NET MVC - Latest & Greatest So Far
Lohith Goudagere Nagaraj
 
PDF
Transitioning Groupon to Node.js - EmpireJS 2014
Sean McCullough
 
KEY
Single Page Applications - Desert Code Camp 2012
Adam Mokan
 
PDF
jQuery Mobile Introduction
Joris Graaumans
 
PDF
UX design for every screen
Four Kitchens
 
PPT
Selenium for everyone
Tft Us
 
The future of web development write once, run everywhere with angular.js and ...
Mark Roden
 
The future of web development write once, run everywhere with angular js an...
Mark Leusink
 
Wheel.js
baccigalupi
 
AngularJS One Day Workshop
Shyam Seshadri
 
A Smooth Transition to HTML5
Chris Bannon
 
Riding the Edge with Ember.js
aortbals
 
UWP apps development - Part 2
Jiri Danihelka
 
Step Into the Future – Blending AR, VR & AI with OutSystems
ShubhamSharma2528
 
Building mobile apps with PhoneGap and Backbone
Troy Miles
 
State of jQuery - AspDotNetStorefront Conference
dmethvin
 
Single Page Application Development with backbone.js and Simple.Web
Chris Canal
 
Node.js 101
FITC
 
Mvvm knockout vs angular
Basarat Syed
 
FITC - Bootstrap Unleashed
Rami Sayar
 
ASP.NET MVC - Latest & Greatest So Far
Lohith Goudagere Nagaraj
 
Transitioning Groupon to Node.js - EmpireJS 2014
Sean McCullough
 
Single Page Applications - Desert Code Camp 2012
Adam Mokan
 
jQuery Mobile Introduction
Joris Graaumans
 
UX design for every screen
Four Kitchens
 
Selenium for everyone
Tft Us
 
Ad

More from Michael Denomy (9)

PDF
Intro to automated testing
Michael Denomy
 
PPTX
Breathe In and Out With Me - Burlington Ruby Conference 2015
Michael Denomy
 
PDF
Writing Maintainable Tests with PageObjects
Michael Denomy
 
PDF
Memory Management in RubyMotion
Michael Denomy
 
PDF
Aikido, Controller Tests, and LinkedIn
Michael Denomy
 
PDF
Reinventing Yourself
Michael Denomy
 
PDF
Design Principles - Michael Denomy at Launch Academy
Michael Denomy
 
PPT
Debugging rails
Michael Denomy
 
PPT
Introduction to Test Driven Development
Michael Denomy
 
Intro to automated testing
Michael Denomy
 
Breathe In and Out With Me - Burlington Ruby Conference 2015
Michael Denomy
 
Writing Maintainable Tests with PageObjects
Michael Denomy
 
Memory Management in RubyMotion
Michael Denomy
 
Aikido, Controller Tests, and LinkedIn
Michael Denomy
 
Reinventing Yourself
Michael Denomy
 
Design Principles - Michael Denomy at Launch Academy
Michael Denomy
 
Debugging rails
Michael Denomy
 
Introduction to Test Driven Development
Michael Denomy
 
Ad

Recently uploaded (20)

PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 

From Ruby on Rails to RubyMotion - Writing your First iOS App with RubyMotion

  • 1. RoR to RubyMotion Writing Your First iOS App With RubyMotion Michael Denomy BostonMotion User Group June 25, 2013
  • 2. About Me • Tech Lead at Cyrus Innovation - Agile web consultancy with offices in New York and Boston - http://www.cyrusinnovation.com • Agile and XP practitioner since 2004 - Passionate about TDD and pairing • mdenomy on twitter and github • Blog at www.mdenomy.wordpress.com
  • 3. Goals • Capture my experiences getting started with RubyMotion - Help someone else along - Get ideas for where to go next • Target Audience - Developers familiar with Ruby on Rails - Little to no previous experience with iOS - Desire to learn • Some talk, some code
  • 6. More Cold Hard Facts • RubyMotion is not free - $199.99 - No trial, but 30 day money back - There is a student discount program • iOS Developer Program is not free - $99 / year - Required to deploy to devices and distribute via AppStore • You will need to understand iOS SDK - iOS documentation is difficult to navigate
  • 9. Good Stuff • Growing community with lots of online resources • More and more gems appearing that provide a Rails-like experience • Free to use the tools you like - Sublime plug in for RubyMotion has code completion and rake shortcuts https://github.com/haraken3/ SublimeRubyMotionBuilder
  • 10. MVC in iOS • MVC is MVC right? • No “convention over configuration” - Have to wire things up manually • Slightly different terminology that Rails
  • 11. UIViewControllers • Controller receives actions from the framework (e.g. view loaded) and the user (e.g. button pressed) - Interacts with Models and View • UIViewControllers you need to know - UINavigationController - UITabBarController - UIViewController - UITableViewController
  • 12. Models • Models are PORO’s in RubyMotion • Support built-in for - attr_accessor - attr_reader - attr_writer • Possible to serialize/deserialize data using NSCoder and NSKeyedArchiver - Looked for other options to support storage and relationships
  • 13. Views • UIView is a base class • Buttons, labels, date pickers, etc., all inherit from UIView • Views can have subviews - Simplifies screen layout and allows re-use
  • 14. Let’s Look at Some Code • Basic Navigation - Application Delegate - Root View Controller - UITabBarController - UIViewControllers
  • 15. MyWines App • I enjoy the occasional glass of wine. • I would like to have a way to track the wines I like and prices I've paid for them - Record tasting notes - Record purchases and price info - Search for wine by name/producer - Save to Favorites - Save label picture • Spoiler alert - I have done next to nothing to style the app
  • 16. Sketch It Out It’s a lot cheaper and faster to iterate at this level than in code
  • 17. What Tools Did I Choose • Bundler - Simplify dependencies • ProMotion - Screen development and workflow • Formotion - Entry/edit forms • MotionModel - Models and relations • Teacup - Styling DSL • Sugarcube - UI extensions • BubbleWrap - I used it for camera, but lots more (JSON, HTTP, RSS, Location, Audio, Video) • MotionAwesome - Buttons and icons More at http://rubymotion-wrappers.com/
  • 18. ProMotion • Simplifies screen development • Support for table screens - Easily search for table entries • Helpers for tab and navbar controllers
  • 19. Formotion • Easily create forms for entry/edit • Integrates with ProMotion • Support For - text - dates - sliders - check boxes - and many more
  • 20. MotionModel • Wanted something like ActiveRecord • Chose MotionModel gem - Lightweight - Feels Railsy ‣ Validations ‣ ActiveRecord-like syntax ‣ Relations - Serialization / deserialization support - Actively maintained - Formotion support(turned out not to matter)
  • 21. Teacup • Layout and style your app in a DSL • Frees you up from layout of screens in XCode • Allows you to keep your views a lot cleaner • Hierarchical and supports variables
  • 22. Sugarcube • Tons of helpful ‘syntactic sugar’ extensions to make your development easier - conversion of hex color codes to UIColor - alert and action dialogs - symbol to iOS, e.g., ‣ :touch.uicontrolevent becomes UIControlEventTouchUpInside - array helpers - hash to object conversions
  • 23. BubbleWrap • Amazing set of tools for - HTTP - JSON - RSS - Camera - Location - Alert boxes - REPL support • Just using it for the camera in my app
  • 24. MotionAwesome • Great set of icons and buttons • Based on FontAwesome • So far only used it to create a camera button using a camera icon
  • 25. Deploying to Device • Must be in Apple Developer Program - $99/year • Get provisioning and developer certificates • Deploy using rake - rake device - Make sure to quit iTunes and Image Capture • Can’t do some things with simulator - e.g. Camera
  • 26. Where Do I Go Next • Better use of views and subviews - As app evolves will have more common controls/groups -> re-use - Easier to lay out due to relative positioning used in subviews • Better/more styling - Will require more understanding of iOS • Persist images to file system • Do more with models - Averages, filtering, etc
  • 27. Where Do I Go Next • Testing - This was very much a spike, but as the app evolves want to incorporate more automated testing - Tested the models, especially persistence and validation since these were areas of risk - Want to look at more integration testing ‣ motion-frank (maintained by Cyrus Innovation) ‣ motion-calabash
  • 28. Questions I Still Have • ProMotion is awesome, but I wonder if down the road this paints me into a corner • Wild West of gems - Will be interesting to see what ideas and tools rise to the top • How much iOS should I learn - Interface Builder - CoreData
  • 29. Resources • RubyMotion Developer Center - http://www.rubymotion.com/developer-center/ • RubyMotion by Clay Allsop - http://pragprog.com/book/carubym/rubymotion • iOS Dev Center - Tons of useful info, navigation is horrible - https://developer.apple.com/devcenter/ios/index.action - https://developer.apple.com/library/ios/#featuredarticles/ ViewControllerPGforiPhoneOS • RubyMotion Wrappers and Libraries - http://rubymotion-wrappers.com/
  • 31. RoR to RubyMotion Writing Your First iOS App Michael Denomy BostonMotion User Group June 25, 2013