Problem recreating Swift Grocery-Sync-iOS

#1

To check my understanding of CBL project setup for Swift, I am trying to “recreate” the Swift version of the Grocery-Sync-iOS project. (It would be lovely to have a Swift version of Building your first Couchbase Lite iOS app.)

I am getting build errors with symbols that obviously should be defined, such as:

  • CBLDatabase
  • CBLManager
  • CBLReplication

Here’s what I did to recreate the project (I think):

  • Create a new 1-window iOS app in Xcode
  • Copy everything from Grocery-Sync’s DemoAppDelegate.swift to the new project’s AppDelegate.swift
  • Copy everything from Grocery-Sync’s RootViewController.swift to the new project’s ViewController.swift
  • Copied Grocery-Sync’s Utilities.Swift to my project’s source folder and added it to the project
  • Added CouchbaseLite.framework and CouchbaseLiteListener.framework to the project
  • Followed the instructions for Creating a New Project on the CBL site’s tutorial to change the Other Linker Flags to -ObjC in Build Settings and added the 5 frameworks listed in the documentation to the Build Phases Link Binary with Libraries
  • My project is called cb1, so I (manually) created a cb1-Bridging-Header.h that contains
    #import <CouchbaseLite/CouchbaseLite.h>

Then I build, and get a slew of failures due to undefined symbols such as the ones listed at the beginning of post.

I can’t follow the tutorial past that, because I’m working in Swift. (I did, however, go through the tutorial in Objective-C first.) What am I missing? The Grocery-Sync project builds, but mine doesn’t. Obviously I’ve omitted a necessary step.

I would think this post and, hopefully, responses with a solution will be of interest to anyone trying to build their first Swift CBL app.

#2

Hi,

Did you mean to post in the Server category? Seems like this should go under Mobile.

Thanks for highlighting the interest in Swift samples. Sorry I can’t give an estimate of when more will come out.

Hod

#3

Whoops. Yes. CBL. I had also been working with the Server, so I guess I got confused. I’ll repost there.