Git Product home page Git Product logo

couchcocoa's Introduction

CouchCocoa: An Objective-C API To Apache CouchDB™

CouchCocoa is a medium-level Objective-C API for working with CouchDB on iOS and Mac OS. By "medium-level" we mean:

  • It doesn't require knowledge of the HTTP API, only of CouchDB's architecture. 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.

This API is not the only way to access CouchDB on iOS and Mac OS. There are other Objective-C APIs available, such as Trundle, or you can go down to the metal and talk to the HTTP API yourself using NSURLConnection.

Kick The Tires!

Join Us

Build Instructions

Prerequisite

Xcode 4.1 or later, with the SDK for iOS 4 or later. (It's possible the project might still work with Xcode 3, but we're not testing or supporting this.)

One-Time Repository Setup

If you cloned the CouchCocoa Git repository, aso opposed to downloading a precompiled framework, then you'll next need to initialize Git "submodules". This will clone the dependency JSONKit into the "vendor" subfolder:

cd CouchCocoa
git submodule init
git submodule update

Running The Mac OS Demo Apps

There are two simple Mac demo apps included in the Demo/ subfolder. One lets you edit a simple list of names and email addresses, the other is a shopping list. (They actually share most of the same source code; all the differences are in their model classes and .xib files, thanks to the magic of Cocoa bindings.) To run them:

  1. Start a CouchDB server (such as Couchbase Server) on localhost.
  2. Open CouchDemo.xcodeproj (in Xcode 4.0.2 or later)
  3. Select "Demo-Addresses" or "Demo-Shopping" from the scheme pop-up in the toolbar
  4. Press the Run button

Building The Framework

(You only need to do this if you checked out the CouchCocoa source code and want to build it yourself. If you downloaded a precompiled framework, just go onto the next section.)

  1. Open CouchDemo.xcodeproj
  2. Select "Mac Framework" or "iOS Framework" from the scheme pop-up in the toolbar
  3. Product > Build

If you want to run the unit tests, first make sure a CouchDB server is running on localhost, then choose Product > Test.

The framework will be located at:

  • Mac: build/CouchCocoa/Build/Products/Debug/CouchCocoa.framework
  • iOS: build/CouchCocoa/Build/Products/Debug-universal/CouchCocoa.framework

Using The Framework In Your Apps

Mac OS:

  1. Build the Mac framework (see above).
  2. Copy CouchCocoa.framework somewhere, either into your project's folder or into a location shared between all your projects.
  3. Open your Xcode project.
  4. Drag the copied framework into the project window's file list.
  5. Add the framework to your target (if you weren't already prompted to in the previous step.)
  6. Edit your target and add a new Copy Files build phase.
  7. Set the build phase's destination to Frameworks, and drag CouchCocoa.framework into its list from the main project file list.

iOS:

  1. Build the iOS framework (see above).
  2. Copy CouchCocoa.framework somewhere, either into your project's folder or into a location shared between all your projects.
  3. Open your Xcode project.
  4. Drag the copied framework into the project window's file list.
  5. Add the framework to your target (if you weren't already prompted to in the previous step.)

You'll probably want to run a local database server on your iOS device, since it'll allow your app to work offline (and improves performance.) CouchCocoa.framework doesn't contain CouchDB itself, so you should also add the Couchbase Mobile framework to your app. Using the two together is very simple: when the CouchbaseMobile object calls your delegate method to tell you the server's up and running, just use the URL it gives you to instantiate a CouchServer object.

License

Released under the Apache license, version 2.0.

Contributors: Jens Alfke, J Chris Anderson

Copyright 2011, Couchbase, Inc.

couchcocoa's People

Contributors

snej avatar jchris avatar

Stargazers

 avatar

Watchers

Eric Blair avatar Rob Rhyne avatar Guy English avatar Cory Bohon avatar Jay Tamboli avatar  avatar James Cloos avatar Karol Munoz avatar  avatar Jenkins Martian avatar Steve Izzo avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.