Skip to content

Latest commit

 

History

History
90 lines (71 loc) · 2.98 KB

README.md

File metadata and controls

90 lines (71 loc) · 2.98 KB

CouchbaseLiteSwift-EE

Repository for hosting Swift package for Couchbase Lite Swift Enterprise Edition

Case 1. Including Couchbase Lite to an existing swift package

Adding CouchbaseLiteSwift dependency to your Parent swift package.

  1. Add the CouchbaseLiteSwift package as dependency:
dependencies: [
        .package(name: "CouchbaseLiteSwift",
                 url: "https://github.com/couchbase/couchbase-lite-swift-ee.git", 
                 from: "3.2.1"),
    ],
  1. Add the dependent package product name, to the target:
targets: [
     .target(name: "ParentPackage",
             dependencies: ["CouchbaseLiteSwift"]),
    ]

  1. Import CouchbaseLiteSwift, and use it:
import CouchbaseLiteSwift 

class ParentPackageSomeClass {
    func someFunction() {
        let db = try! Database(name: "testdb")
        print(">> opening the db: \(db.name)")
    }
}

Sample Manifest file

// 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"]),
    ]
)

Case 2. Including Couchbase Lite directly to your app project

Add CouchbaseLiteSwift to your HostApp

  1. Project to which you are going to add the CouchbaseLiteSwift

1

  1. Click on the add package dependency button, (Xcode Project File > Project Settings > Swift Packages > Add Package Dependency)

2

  1. Enter the URL, https://github.com/couchbase/couchbase-lite-swift-ee.git

3

  1. Specify the version

4

  1. Finish

5

  1. You will see the name, version and URL of the added CouchbaseLiteSwift Package

6

  1. Import CouchbaseLiteSwift, and use it.

7