Repository for hosting Swift package for Couchbase Lite Swift Enterprise Edition
Adding CouchbaseLiteSwift dependency to your Parent swift package.
- Add the CouchbaseLiteSwift package as dependency:
dependencies: [
.package(name: "CouchbaseLiteSwift",
url: "https://github.com/couchbase/couchbase-lite-swift-ee.git",
from: "3.2.1"),
],
- Add the dependent package product name, to the target:
targets: [
.target(name: "ParentPackage",
dependencies: ["CouchbaseLiteSwift"]),
]
- Import CouchbaseLiteSwift, and use it:
import CouchbaseLiteSwift
class ParentPackageSomeClass {
func someFunction() {
let db = try! Database(name: "testdb")
print(">> opening the db: \(db.name)")
}
}
// swift-tools-version:5.8
import PackageDescription
let package = Package(
name: "ParentPackage",
products: [
.library(
name: "ParentPackage",
targets: ["ParentPackage"]),
],
dependencies: [
.package(name: "CouchbaseLiteSwift",
url: "https://github.com/couchbase/couchbase-lite-swift-ee.git",
from: "3.2.1"),
],
targets: [
.target(
name: "ParentPackage",
dependencies: ["CouchbaseLiteSwift"]),
.testTarget(
name: "ParentPackageTests",
dependencies: ["ParentPackage"]),
]
)
Add CouchbaseLiteSwift to your HostApp
- Project to which you are going to add the CouchbaseLiteSwift
- Click on the add package dependency button, (Xcode Project File > Project Settings > Swift Packages > Add Package Dependency)
- Enter the URL,
https://github.com/couchbase/couchbase-lite-swift-ee.git
- Specify the version
- Finish
- You will see the name, version and URL of the added CouchbaseLiteSwift Package
- Import CouchbaseLiteSwift, and use it.