CouchbaseLite has been released for sometime now, so I thought it is time to
give an update for using CouchbaseLite from RubyMotion.
When I ported ToDoLite-iOS to
RubyMotion originally there where some bumps in the road, but it worked over
all. There were for example some problems with RubyMotion not handling lambdas
the way CouchbaseLite needs them, but this has been resolved since then. If you
don’t know what I mean by that, you can be happy and forget all about it, or
read up on
it.
So what do I need now to get going with CouchbaseLite and iOS?
By now it is possible to go 100% ruby for a RubyMotion project using
CouchbaseLite, which is great. CouchbaseLite has been publicly released, is out
of beta and has already received much love in terms of patches to make it work
even more reliably cross all platforms. In case of RubyMotion this made things
much easier, and the process is by now:
- Add couchbase-lite via cocoapods
- Tell rubymotion where to find the header files
- Use it!
Installing CouchbaseLite via Cocoapods
Cocoapods is an awesome package manager for iOS and
MacOS projects, and it integrates really well with RubyMotion. All there is todo
is add cocoapods and motion-cocoapods to your gemfile
Now you can install any cocoapods by adding them to the Rakefile and running
“bundle exec rake pod:install”
Important side not, make sure to include
as the headers are not going to be found otherwise.
Using Couchbase Lite from RubyMotion
You can now use CouchbaseLite like you would any other Obj-C library from
rubymotion, for example to define a view which grabs all the “lists” in the
database you can write this
For more details checkout the RubyMotion Sample project on
Github.