CouchbaseLite – Module maps

Veröffentlicht von Marco Betschart am

As convenient as the bridging header is, it has one key limitation—you can’t use it inside a framework project.  The alternative is to use a module.

This can be problematic when using Couchbase Lite for iOS for example.

To do this, create a directory in your project directory named CouchbaseLite. Inside the directory, create a module.map file that encapsulates library settings. For CouchbaseLitemodule.map looks like this:

module CouchbaseLite {
  header "../Pods/couchbase-lite-ios/CouchbaseLite.framework/Headers/CouchbaseLite.h"
  export *
}

Now add the new module to Import Paths under Swift Compiler – Search Paths in your project settings. Use ${SRCROOT} in the module path (e.g. ${SRCROOT}/CouchbaseLite) to insure that the project works no matter where it’s checked out.

SwiftCompiler - Search Paths - CouchbaseLite

This makes it possible to just import CouchbaseLite in your Swift files. Note that consumers of any frameworks you build using this technique are also going to have to add the module to their Swift search paths.

Many thanks and © to Matt Behrens!

Kategorien: Technologie

Marco Betschart

nerdpreneur out of conviction. lover of the never ending journey of exploration. self growth and tech enthusiast. ambitious rock climber and from time to time, adrenaline junkie.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.