Skip to content

How to embed Couchbase Lite iOS into an existing Swift project

Traun Leyden edited this page Feb 28, 2018 · 1 revision

Problem

If you download the pre-built Couchbase Lite iOS and drop it into your project as a framework, it's not easy to set breakpoints in the Couchbase Lite iOS or LiteCore code.

This is mainly of interest to core Couchbase developers, but it might also be useful for users who are running into a crash and want to debug further to find out the root cause (which can in some cases speed up bug fixes)

Steps

This will use the mobile-training-todo sample app as an example app.

  1. In your project explorer, go to Frameworks and delete CouchbaseLite
  2. git clone the https://github.com/couchbase/couchbase-lite-ios repo somewhere
  3. In the finder, navigate to the CouchbaseLite.xcodeproj
  4. Drag CouchbaseLite.xcodeproj into the mobile-training-todo project (or your own project)
  5. You should see something like this: screen shot 2018-02-28 at 3 20 30 pm
  6. If you don't have an "expander triangle" next to the CouchbaseLite.xcodeproj subproject, try restarting XCode
  7. Under the top level project build settings, update Target Dependencies and Copy Files sections to include the subproject framework, like this: screen shot 2018-02-28 at 3 23 41 pm
  8. At this point, you should be able to build the project without errors
  9. Now you can set breakpoints anywhere inside Couchbase Lite ios or LiteCore
  10. Additionally, you can edit any files in Couchbase Lite iOS or LiteCore and rebuild, and the changes will get picked up