IOS CBL and Catalyst

I have a 2.5 branch that works, but I’ll want to recreate with just the minimal number of changes necessary. I suspect there is a more direct route, as opposed to the wandering path I took to get there.

I’d like to also get this working with 1.x as my primary project has yet to migrate to 2.x. However, we currently use a custom build of 1.4 that cherry picks a commit from 1.4.1.

+1 on the 1.4x support!

T

For 1.x, we run a build phase script which executes BuildFatLibrary.sh to generate a fat library, but the script for building library per platform.

You can create an independent script to generate XCFramework by building CBL-iOS from CI iOS scheme and CBL-MacOS from CI MacOS scheme and combining them. You will need to disable the build phase that builds the fat library as well.

A huge thanks to the community for helping with this.
However, I was unable to get it to work myself. Is there any fork that can be built without changing the scripts on your own?
I am also a bit confused with which branch to try, given that there is the xcframework, xcode11Beta and the current 2.5 release line.

I was able to build the three frameworks. However, in the end your approach has resulted in the following error for me:

No ‘swiftinterface’ files found within ‘XXX/Projects/couchbase-lite-ios/iosdevice/CouchbaseLiteSwift.framework/Modules/CouchbaseLiteSwift.swiftmodule’.

Do you have any suggestions on how to fix this? Also what exactly did you mean by:

add the additional “x86_64 i386” architectures to the assigned.xconfig

At what point did you receive that error? I managed to create an xcframework from the individual .framework builds, but never got a chance to test it as my project has a number of other framework dependencies that have yet to be updated.

Also what exactly did you mean by:

add the additional “x86_64 i386” architectures to the assigned.xconfig

I was referring to the .xconfig assigned to the iOS target. You’ll need to officially add that architecture as a “first class” citizen, as opposed to ending up with a x68_64 slice as a means to provide support for the iOS simulator. While they are the same platform, Catalyst seems to consider them separately.

I received the error already when running the xcodebuild -create-xcframework command.

Did you add that manually,m direclty in the .CBL-Swift.xcconfig file or in the Xcode project’s CBL Swift target as a ‘Valid architecture’?

Anyone tried?
a. switching to xcframework branch
b. run the sh Scripts/build_xcframework.sh -s "CBL Swift" -o ~/Desktop/out

Yes, unfortunately there is an error.
It says: While building for Mac Catalyst, no library for this platform was found in 'CouchbaseLiteSwift.xcframework'

Is there any indication as to when you will be able to provide an official fix for the Catalyst situation? Other dependencies we use, such as Moya, Kingfisher, Bugsnag or Mixpanel all have working betas via Cocoapods already.

Currently the script will only include
(i)generic/platform=iOS,
(ii)generic/platform=iOS Simulator, and
(iii)generic/platform=macOS

There was not much of a documentation found for mac catalyst specific configuration to archive. “platform=macOS,arch=x86_64,variant=Mac Catalyst” results in, unable to find destination errors in OSX Catalina and OSX Mojave. Hoping to get more clear picture in coming days.

Did you ever figure out how to get past the “no library for this platform was found” error? I’m trying to compile for Mac Catalyst now with CBL 1.4.x.

So it seems that you can’t build the CI MacOS scheme in Xcode for Catalyst. You have to build the CI iOS scheme and enable Mac catalyst support on it. Then you can choose the Mac to build it in the schema popup menu. But this brings with it a host of problems with deprecated spin lock methods in memleak.cc and missing Endian.h in PSWebSocketDriver and who knows what else.

I really wish that Couchbase hadn’t abandoned CBL 1.4 or at least in CBL 2.x added support for CouchDB sync, which is the reason why I’m still on 1.4.x.

My dreams of using Catalyst may be shot.

Why aren’t you using the Sync Gateway at the sync endpoint with CBL clients ? The web sockets based 2.x replication protocol is vast improvement over the 1.x HTTP based version in terms of resource utilization (full duplex), efficiency (messaging overhead) and perf. Also gives us the ability to evolve the protocol with advanced capabilities like delta sync, conflict resolution etc

I wish I could. But I don’t host my customers’ sync data myself. I don’t want to have to manage a server environment that my customers use. They take care of syncing themselves either with IBM Cloudant, Apache CouchDB, Peer to Peer, or iCloud sync (which I built on top of CBL). My app is a consumer app, not an enterprise app. Anyone can buy it on the iOS and Mac App Stores. Does Sync Gateway even have a web GUI for configuration like CouchDB does with their Fauxton web interface? My customers span the full gamut of ages and experiences. So having them setup their own Couchbase Server and Sync Gateway is too much for them to have to learn. At least with CouchDB there’s a double-clickable Mac app and a web interface for configuration and it’s not too difficult with the instructions I wrote up for it.

I understand that CBL 2.x probably has a much better sync solution, but the amount of work necessary to migrate to 2.x would seem daunting to me. Did you even add CBLModel to it? I rely heavily on that in my app.

Are they any news on that?

It is still very important, are you working on that @jens?

Catalyst is not a high priority right now, but we will look at it as soon as we can.

This Jira ticket will show the progress. If there is any update happened, will update it CBL-399

A related update - Mac Catalyst support is available in Couchbase Lite 2.8.4. This is distributed as .xcframework via our downloads page or via Swift Package Manager.

1 Like