As Ruby Developer I've had a pretty involved relationship with my Mac. I own iPads and iPhones since Apple started to make them. A few years back I told myself I was going to build apps for the Mac/iPhone/iPad but then reality sunk in when I started learning Objective-C and using XCode. The environment (and the language) felt like a trip back to 1995.
If you are a Web developer used to working with dynamically-typed, lightweight languages, following agile practices like Test-Driven Development, and comfortable with a Unix Shell, then jumping into a development world with an ugly cousin of C++ and an IDE that looks like an F16 cockpit just doesn’t seem appealing.
Luckily for us there is an alternative in RubyMotion, a Ruby-based toolchain for iOS that brings a Ruby on Rails style of development to the world of iOS application development.
In this talk I will show you how you can use well engrained Ruby practices like TDD to build iOS Apps with RubyMotion.
22. (Ruby & Web) Developers new to iOS
Those comfortable with a *NIX Shell
and Agile Practices like BDD & TDD
Thursday, May 2, 13
23. Why don’t you just build a Mobile Web App?
Thursday, May 2, 13
24. “The most common reason for this is that [native]
apps are seen to be more convenient (55%), faster
(48%) and easier to browse (40%)”
http://econsultancy.com/us/blog/62326-85-of-consumers-favour-apps-over-mobile-websites
Thursday, May 2, 13
29. Rake-Driven Development
/> rake -T
rake archive # Create an .ipa archive
rake archive:distribution # Create an .ipa archive for distribution (AppStore)
rake build # Build everything
rake build:device # Build the device version
rake build:simulator # Build the simulator version
rake clean # Clear build objects
rake config # Show project config
rake ctags # Generate ctags
rake default # Build the project, then run the simulator
rake device # Deploy on the device
rake simulator # Run the simulator
rake spec # Same as 'spec:simulator'
rake spec:device # Run the test/spec suite on the device
rake spec:simulator # Run the test/spec suite on the simulator
rake static # Create a .a static library
Thursday, May 2, 13
34. our vehicle for BDD & TDD
bundled with MacBacon
https://github.com/alloy/MacBacon
a small clone of RSpec
http://rspec.info/
Thursday, May 2, 13
35. A slice of MacBacon
describe 'A new array' do
before do
@ary = Array.new
end
it 'should be empty' do
@ary.should.be.empty
@ary.should.not.include 1
end
it 'should have zero size' do
@ary.size.should.equal 0
@ary.size.should.be.close 0.1, 0.5
end
Thursday, May 2, 13
36. A slice of MacBacon
describe 'A new array' do
before do
@ary = Array.new
end
it 'should be empty' do
@ary.should.be.empty
@ary.should.not.include 1
end
it 'should have zero size' do
@ary.size.should.equal 0
@ary.size.should.be.close 0.1, 0.5
end
it 'should raise on trying fetch any index' do
lambda { @ary.fetch 0 }.
should.raise(IndexError).
message.should.match(/out of array/)
# Alternatively:
should.raise(IndexError) { @ary.fetch 0 }
end
it 'should have an object identity' do
@ary.should.not.be.same_as Array.new
end
it 'should perform a long running operation' do
@ary.performSelector("addObject:", withObject:"soup", afterDelay:0.5)
wait 0.6 do
@ary.size.should.be 1
end
end
Thursday, May 2, 13
37. RM TDDHighlights
Testing with Bacon
Red-Green-Refactor for iOS
Libraries: MotionModel & Formotion
Thursday, May 2, 13
41. Healthy, rapidly growing set of libraries
BubbleWrap, MotionModel, FormMotion,
Teacup, IB and many, many more
There’s a Gem for that!
Thursday, May 2, 13
46. Thanks
All example code available at:
Watch out for an upcoming ebook at http://integrallis.com
https://github.com/integrallis/okonawa
Thursday, May 2, 13