Building your first Couchbase Lite iOS app

This tutorial shows you how to use Couchbase Lite in your iOS apps. The tutorial assumes you already know how to develop iOS apps and have Xcode 5 or later installed on your computer.

If you need to learn about iOS programming, a good place to start is by reading Apple’s free tutorial, Start Developing iOS Apps Today, which provides a hands-on introduction to iOS app development. To access the Apple tutorial, you need to register for a free Apple developer account.

The tutorial walks through creating a simple Hello World-style app called HelloCBL. By following the tutorial, you'll learn how to create a new Couchbase Lite iOS app, create a database, and interact with the database by using basic CRUD (create, read, update, and delete) operations.

To make it easier to learn the basics and get started with Couchbase Lite, the program structure is highly simplified. HelloCBL does not have a UI and all code is placed in the application delegate class, HCAppDelegate. All output is sent to the Xcode console rather than the iPhone screen in the simulator. Rest assured, the other sample iOS apps that we provide do not take these shortcuts—they incorporate standard iOS software design and development practices.

You can follow along with the tutorial and build the HelloCBL app yourself, or you can download the HelloCBL code from GitHub.


Creating a new project
Introduction to creating Couchbase Lite app
Creating the manager and a database
Create a manager and a database for CouchbaseEvents
Performing CRUD operations
Create, retrieve, update, and delete documents
Add Sync Gateway
Understanding Sync Gateway and setting up a connection to Couchbase Server
Working with Views
Introducing Views through code
Understanding LiveQuery