Whilst RubyMotion is new, and the number of RubyMotion specific libraries is growing fast, there are already loads of native Objective-C libraries out there.
Cocoapods is a dependency manager, like RubyGems, but for Objective-C projects.
In this example, I’ve chosen to install ViewDeck. ViewDeck makes it easy to implement the sliding panel user interface made popular by the Facebook iOS app.
The CocoaPods website is a great place to search for available ‘Pods’.
Summary of steps
- Include the motion-cocoapods gem
- Setup Cocoapods
- Add ViewDeck to your application Rakefile
If you haven’t got Bundler setup, I’ve written some instructions for using Bundler with RubyMotion.
Add cocoapods to your Gemfile:
Install the gem via bundler:
Setup Cocoapods via:
$ pod setup
Add ViewDeck to your Rakefile
In your Rakefile you need to add the ViewDeck pod and QuartzCore Framework (required by ViewDeck):
Motion::Project::App.setup do |app| # Frameworks app.frameworks += [ 'QuartzCore' ] # Cocoapods app.pods do pod 'ViewDeck' end end
motion-cocoapods to download your dependencies by running:
$ rake pod:install
ViewDeck will be automatically built and linked the next time you build your app.
In future you can grab updated versions by running:
$ rake pod:update
I’ve ported the Objective-C example ViewDeck application over to RubyMotion.