couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <>
Subject ANN: CouchCocoa framework (Objective-C API)
Date Sat, 23 Jul 2011 20:26:43 GMT
CouchCocoa is a new Objective-C API for CouchDB on iOS and Mac OS. It’s “medium-level”,
in that:

• It doesn't require knowledge of the HTTP API, only of CouchDB's architecture, so you won't
have to remember special paths or URL query parameters.
• But it doesn't provide a full-fledged model layer like CoreData or ActiveRecord. You're
still working with CouchDB documents as, basically, NSDictionaries, and you'll need your own
mapping between those and your app's object model.
• It usually provides both high-level and low-level ways to do the same thing. So you can
call CouchDocument’s -resolveConflictingRevisions: method, or if you’re a REST jockey
you can assemble your own JSON data and call -POST: yourself.

A key feature is that it provides document change notifications, driven by the _changes feed,
and filters out local changes made by your app from external ones made by other apps or by
replication. Thus you can easily detect when external changes are made, and check for conflicts
and update your UI.

Speaking of conflicts, the API provides easy access to a document’s revision history (via
CouchRevision objects) and lets you compare the conflicting revisions and choose which properties
should be in the resolved document.

There are some experimental classes (part of the Mac demo apps) that interface CouchDB views
to Cocoa bindings, which lets you do a lot of the work of building a Mac app entirely in Interface
Builder, with very little coding. (Unfortunately iOS doesn’t support bindings yet.)

[We have an iOS demo app using CouchCocoa almost ready, a modified version of the one in the
iOS-Couchbase repo. Chris will have it up ASAP.]

The code is roughly at alpha level, by which I mean that it’s working, and suitable for
people to start development with; but on the other hand you should expect bugs and limitations,
and future API changes.

I’m excited to be developing this as part of my day job at Couchbase. This open-source framework
will be a supported part of the Mobile Couchbase product. But we’re not positioning it as
the One True Way to use Couchbase on iOS and Mac OS, any more than CouchRest is the One True
Way on Ruby. You can of course still use Trundle, or roll your own interface on top of NSURLConnection.
But we want to make CouchCocoa easy as powerful and easy to use as we can, to help you build
amazing applications. And of course, it’s open source, and we welcome your contributions
to it.

Repo & source code:
Example snippets:
API docs:


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message