1. Linkedin: October 18, 2012
2012 Fukuoka Ruby Night:
The New World of Ruby
Ruby and iOS: An Inside Look
Jeanine Swatton
2. More about me…
Ruby/iOS Developer, QT, C, C++
Senior Lecturer, Assistant Professor
Engineering experience:
Government, Surveillance and Video Conferencing
Organizer, Silicon Valley Ruby on Rails Meetup
Software Product Manager
10/18/2012 Jeanine Swatton 2
3. Agenda for today
1. Why go mobile?
2. Benefits of Native Mobile App
3. mRuby + iOS
4. RubyMotion
10/18/2012 Jeanine Swatton 3
10. Definitions
• Native:
• App designed to run on a device’s OS and
machine firmware. (Example iPhone Apps run
on iOS platform, Symbian for Nokia.
• Web app:
• All or some parts of software are downloaded
from web. Coded in browser-rendered
language – HTML, javascript
10/18/2012 Jeanine Swatton 10
11. Definitions
• Hybrid: Combination of offline and online
functionality within native app 3 forms:
1. Requires you to be online to get data or information
2. Has native interface then pulls data via API’s into app and
may sync with database. Ex. Rhapsody – Gives you
offline screen you can access saved content – online –
you have full access to music you can stream.
3. Uses mobile site to display info within an application shell.
Done using tools such as PhoneGap. Tools provide
interface using jafascript to native API’s – then allows a
webview to interact with native functionality such as
cameras, GPS and device info
10/18/2012 Jeanine Swatton 11
12. Mobile Trends
App development comparison
10/18/2012 Jeanine Swatton 12
14. Mobile Trends
Solution?
Web Apps w/ use of core web technologies: CSS3,
HTML5
10/18/2012 Jeanine Swatton 14
15. Mobile Trends
When would you need a native app over a
Mobile-Web based app?
10/18/2012 Jeanine Swatton 15
16. Native Apps
Native app advantages:
Better control over the User Interface
Platform API (application programming interface) access not
available to web apps
Network usage is lower for native – access network for data
rather than web app completely loading at run-time
Offline functionality
Users more willing to download app than downloading from
the internet
Native app disadvantages:
More maintenance with multiple platforms
Have to update app then submit it
10/18/2012 Jeanine Swatton 16
17. Which App?
Which type of companies would be a better fit for
native, Web or both?
10/18/2012 Jeanine Swatton 17
18. Which App?
Native approach more used by:
Gaming, social networking, lifestyle & entertainment,
gadgets, travel and local
Web based approach:
News and weather publishers. Sometimes financial
services, retail and shopping due to need for user
analytics
10/18/2012 Jeanine Swatton 18
19. What strategy do companies also use?
Tech Startups/Companies new to the mobile side
(depending on funds)
10/18/2012 Jeanine Swatton 19
20. Why Ruby on Mobile?
• Simple transition from Web
applications to mobile applications
• Grow the Ruby community even more!
• Support of mRuby
• Think outside of the box!
10/18/2012 Jeanine Swatton 20
21. Intro to iOS Development
In 5 minutes
10/18/2012 Jeanine Swatton 21
22. iOS Development
What you need to know
• Objective C – superset of C
• Delegates – one object depends on
another object to perform functions.
• Protocols – declare methods to be
implemented by any class
• ARC – Automatic Reference
Counting/Memory Management
10/18/2012 Jeanine Swatton 22
23. iOS Development
Application/Directory Structure
File types:
.m – Main file (equivalent to C++ .cpp file)
.h – Header file (equivalent to C++ header
file)
.framework
.plist – property list files
.xib – “Nib files”
10/18/2012 Jeanine Swatton 23
30. MobiRuby
Developed by:
Yuichiro MASUI
http://mobiruby.org/
His plans:
Will be adding it to Android!
10/18/2012 Jeanine Swatton 30
31. MobiRuby Stack
Thanks to: Yuichiro MASUI
Your code
mruby – muby – mobiruby - mobiruby -
cfunc cocoa common ios
mruby
IOS
10/18/2012 Jeanine Swatton 31
32. MobiRuby
Thanks to: Yuichiro MASUI – feedback from the creator
• mruby-cfunc
– C function bridge for mruby
– Based on libFFI
• mruby-cocoa
– Garbage collection
– Cocoa bridge for mruby
• mobiruby-ios
– Xcode integration
10/18/2012 Jeanine Swatton 32
C function bridge for mruby – call c based function directlyCocoa bridge for mruby – use cocoa functions transparently, handles garbage collectionMobiruby-common – believe that’s for android onlyMobiruby-ios provides you with xcode integration, iOS specific utilities
A portable foreign function interface library is libffi – released in april as well..The libffi library is useful to anyone trying to build a bridge between interpreted and natively compiled code.C function bridge for mruby – call c based function directlyCocoa bridge for mruby – use cocoa functions transparently, handles garbage collectionMobiruby-common – believe that’s for android onlyMobiruby-ios provides you with xcode integration, iOS specific utilities
Xcodeproj lets you create and modify Xcode projects from Ruby.Nokogiri – xml parser