Why no pointers to Swift documentation for interacting with the server

I want to write a command-line program in Swift that interacts with the CB server. At the pages for the CB Developer Guide and the devguide examples (which are hard enough to find) there are many languages listed but not Swift.

I realize that Swift is relevant mostly to iOS apps and OS X applications using CBL rather than talking directly to the server without a GUI, but I would like to see the same kind of examples as shown for, e.g. Python SDK. Working with the server was really simple given the examples and the general documentation of the Server API.

Or am I trying to do something nonsensical or even impossible? Is there simply no Swift (Objective-C) interface to the CB Server — just to CB Lite?

2 cents from an enthusiast and new to swift.

I have repeated the getting started guide using libcouchbase C SDK with swift. You can find the project here: https://github.com/Zev23/CouchbaseSwift

I can use the C SDK by setting up module.modulemap file and also include the library path during build.
The project only builds in terminal. I cannot build in Xcode because i just couldn’t figure out how to setup the include search path correctly.

1 Like

Excellent! That’s been close to the top of my To Do list for weeks. I haven’t looked at your code but will do so soon. Thank you very much for working out all the details. Maybe I’ll take a look at making this work in Xcode.

I went crazy trying to reproduce the Swift Grocery Sync example. I was having a hard time building my first CBL app in Swift. There is a lot of detail you have to get right. So I tried another tactic: starting from a working app and strip it down towards what I wanted. I started a new project and copied the source code and UI files. It didn’t come close to compiling. With some help from this forum, and much struggle, I finally got the various project settings adjusted to the point where it would almost compile. I had named my files differently, which I think screwed up the interface connections. But there was something even more problematic about copying the code and its connection to the interface files. I don’t remember what it was, but it was fatal to my efforts, and I gave up.

Examples of both command-line Swift and simple Swift apps — especially recreating the Objective-C CBL demo — are sorely needed. So far the response I’ve gotten on the forum is along the lines of “yeah, well, we really should do that, but it isn’t going to happen any time soon”.

It will be great if you can make it build in Xcode :smiley:.

Another way to query Couchbase Server with server-side swift is using NSTask to run shell command (eg. cbc-n1ql). Seems like a lot easier than calling the C SDK but I haven’t try it yet.

I haven’t develop any CBL app yet. Will try it out soon.