---
title: Install Couchbase Lite on Swift
description: Installing Couchbase Lite on Swift
pubDate: 2026-08-17T09:53:44.266Z
antora:
  editUrl: https://github.com/couchbase/docs-couchbase-lite/edit/release/4.1/modules/swift/pages/gs-install.adoc
  xref: xref:couchbase-lite:swift:gs-install.adoc[]
---

[Consult the llms.txt file for a full list of contents](/llms.txt)
[View original HTML](/couchbase-lite/current/swift/gs-install.html)

# Install Couchbase Lite on Swift

> Description — _Installing Couchbase Lite on Swift_  

## [](#get-started)Get Started

To get started coding Couchbase Lite for Swift apps, just create or open an existing _XCode_ project and install the required _Couchbase Lite_ version, for example 4.1.0, using one of the [Install Couchbase Lite](#lbl-install-tabs) methods shown.

Enterprise users can also download the Couchbase Lite Vector Search extension library.

> [!NOTE]
> Couchbase Lite is distributed as an XCFramework, to support this:
> 
> * The minimum required CocoaPods version is **1.15**
> * The minimum required Carthage version is **0.38**

### [](#lbl-install-tabs)Install Couchbase Lite

.

* Direct Download
* Carthage
* CocoaPods
* Swift Package Manager

1. Download the binaries from here — [Extend with Mobile](https://www.couchbase.com/downloads#extend-with-mobile).
2. Unpack the download zip file into your XCode project location.
3. Select your target settings in XCode and drag **CouchbaseLiteSwift.xcframework** from your Finder to the **Frameworks, Libraries, and Embedded Content** section.
4. Start using Couchbase Lite on Swift in your project.

> [!NOTE]
> The minimum required Carthage version is **0.38+**

1. Install Carthage using the instructions here:  
<https://github.com/Carthage/Carthage#installing-carthage>
2. In your **Cartfile**, add the appropriate 'binary' URL:  
Couchbase Lite Community Edition  
```ruby  
binary "https://packages.couchbase.com/releases/couchbase-lite-ios/carthage/CouchbaseLite-Community.json" ~> 4.1.0  
```

| **1** | Specify the required version number, here we use the latest version |
| ----- | ------------------------------------------------------------------- |  
Couchbase Lite Enterprise Edition  
```ruby  
binary "https://packages.couchbase.com/releases/couchbase-lite-ios/carthage/CouchbaseLite-Enterprise.json" ~> 4.1.0 (1)  
```

| **1** | Specify the required version number, here we use the latest version |
| ----- | ------------------------------------------------------------------- |
3. Run `carthage update --platform ios`.
4. Drag **CouchbaseLiteSwift.xcframework** from **Carthage/Build/** to the Xcode navigator.
5. Select **Project** **General** **Embedded Binary**, add **CouchbaseLiteSwift.xcframework** to this section.

> [!NOTE]
> The minimum required Cocoapods version is **1.15**

1. Install CocoaPods using the instructions here:  
<https://guides.cocoapods.org/using/getting-started.html>
2. Add one of these targets to your **Podfile**:  
Couchbase Lite Community Edition  
```ruby  
target 'Example' do  
  use_frameworks!  
  pod 'CouchbaseLite-Swift', '4.1.0' (1)  
end  
```

| **1** | Specify the required version number, here we use the latest version |
| ----- | ------------------------------------------------------------------- |  
Couchbase Lite Enterprise Edition  
```ruby  
target 'Example' do  
  use_frameworks!  
  pod 'CouchbaseLite-Swift-Enterprise', '4.1.0' (1)  
end  
```

| **1** | Specify the required version number, here we use the latest version |
| ----- | ------------------------------------------------------------------- |
3. Install the pods and open the `.xcworkspace` file generated by CocoaPods, using:  
```bash  
pod install  
```

> [!IMPORTANT]
> Starting with version 4.0, the Swift Package Manager repository URL for Community Edition has changed:

* **Version 3.x and earlier:** <https://github.com/couchbase/couchbase-lite-ios.git>
* **Version 4.0 and later:** <https://github.com/couchbase/couchbase-lite-swift.git>

If you're upgrading from 3.x to 4.0, you must update the repository URL in your Package.swift file or Xcode project settings.

For Enterprise Edition - continue using <https://github.com/couchbase/couchbase-lite-swift-ee.git>

This tab explains how to include the CouchbaseLiteSwift package within your app  
See: [Example 1](#case-1) | [Example 2](#case-2)

> [!NOTE]
> Using Swift Package Manager to install CouchbaseLiteSwift requires XCode 12+

Example 1\. Use Case 1\. Include in Existing Swift Package

Here you'll add the `CouchbaseLiteSwift` dependency to your Parent Swift package — see: [Simple Manifest](#sample) for the sample manifest.

1. Add the CouchbaseLiteSwift package as dependency by including the following in the parent package manifest:  
```swift  
dependencies: [  
  .package(name: "CouchbaseLiteSwift",  
    url: "insert Couchbase Lite URL", (1)  
    from: "4.1.0"), (2)  
  ],  
```

| **1** | Insert appropriate Couchbase Lite URL:For Community Edition use: <https://github.com/couchbase/couchbase-lite-ios.git>For Enterprise Edition use: <https://github.com/couchbase/couchbase-lite-swift-ee.git> |
| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

| **1** | Include the required version number here, for example the latest version is 4.1.0 |
| ----- | --------------------------------------------------------------------------------- |
2. Add the dependent package product name, to the target:  
```swift  
targets: [  
  .target(name: "ParentPackage",  
    dependencies: ["CouchbaseLiteSwift"]),  
  ]  
```
3. Import CouchbaseLiteSwift, and use it:  
```swift  
import CouchbaseLiteSwift  
class ParentPackageSomeClass {  
  func someFunction() {  
    let db = try! Database(name: "testdb")  
    print(">> opening the db: \(db.name)")  
  }  
}  
```

Simple Manifest

```swift
// swift-tools-version:5.3
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: "4.1.0"),
  ],
targets: [
  .target(
    name: "ParentPackage",
    dependencies: ["CouchbaseLiteSwift"]),
  .testTarget(
    name: "ParentPackageTests",
    dependencies: ["ParentPackage"]),
  ]
)
```

Example 2\. Use Case 2\. Include in Your App Project

Here you'll add `CouchbaseLiteSwift` directly into your app

1. Open the project to which you are going to add CouchbaseLiteSwift  
![spm 1](_images/spm-1.png)
2. Open the Project Editor to add a dependency

  1. In _Project Navigator_:  
**Select** your Xcode project file (for example, `HostApp` in the example)  
  Xcode opens the _Project Editor_ pane
  2. In the _Project Editor_ pane:  
**Select** **Project** **Swift Packages** and **+** to add the dependency  
  Xcode opens the _Choose Package Repository_ dialog  
  ![spm 2](_images/spm-2.png)
3. In the _Choose Package Repository_ dialog:  
**Enter** the appropriate Couchbase Lite URL, **Next** to continue  
For example: <https://github.com/couchbase/couchbase-lite-swift-ee.git>  
![spm 3](_images/spm-3.png)
4. **Enter** the required **_Version_** (the latest is 4.1.0) and **Next** to continue  
![spm 4](_images/spm-4.png)
5. **Finish** to close the _Choose Package Repository_ dialog  
![spm 5](_images/spm-5.png)  
Xcode displays the name, version and URL of the added CouchbaseLiteSwift Package  
![spm 6](_images/spm-6.png)
6. You can now import CouchbaseLiteSwift, and use it in your app  
![spm 7](_images/spm-7.png)

## [](#install-vector-search-extension)Install Vector Search Extension

> [!NOTE]
> The Vector Search extension is an **Enterprise-only** feature.

You can get set up with the Vector Search Extension for iOS (Swift) by following these instructions.

> [!IMPORTANT]
> To use Vector Search, you must have Couchbase Lite installed and add the Vector Search extension to your Couchbase Lite application. Vector Search is available only for 64-bit architectures and Intel processors that support the Advanced Vector Extensions 2 (AVX2) instruction set. To verify whether your device supports the AVX2 instructions set, [follow these instructions.](https://www.intel.com/content/www/us/en/support/articles/000090473/processors/intel-core-processors.html)

* Direct Download
* Carthage
* CocoaPods
* Swift Package Manager

1. Download the binaries from here — [binary download link.](https://packages.couchbase.com/releases/couchbase-lite-vector-search/2.0.0/couchbase-lite-vector-search%5Fxcframework%5F2.0.0.zip)
2. Unpack the download zip file into your XCode project location.
3. Select your target settings in XCode and drag **CouchbaseLiteVectorSearch.xcframework** from your Finder to the **Frameworks, Libraries, and Embedded Content** section.
4. Start using Couchbase Lite Vector Search on Swift in your project.

> [!NOTE]
> The minimum required Carthage version is **0.38+**

1. Install Carthage using the instructions here:  
<https://github.com/Carthage/Carthage#installing-carthage>
2. In your **Cartfile**, add the appropriate 'binary' URL:  
```ruby  
binary "http://packages.couchbase.com/releases/couchbase-lite-vector-search/carthage/CouchbaseLiteVectorSearch.json" ~> 2.0.0 (1)  
```

| **1** | Specify the required version number, here we use the latest version |
| ----- | ------------------------------------------------------------------- |
3. Run `carthage update --platform ios`.
4. Drag **CouchbaseLiteVectorSearch.xcframework** from **Carthage/Build/** to the Xcode navigator.
5. Select **Project** **General** **Embedded Binary**, add **CouchbaseLiteVectorSearch.xcframework** to this section.

> [!NOTE]
> The minimum required CocoaPods version is **1.15**

1. Install CocoaPods using the instructions here:  
<https://guides.cocoapods.org/using/getting-started.html>
2. Add one of these targets to your **Podfile**:  
Couchbase Lite Enterprise Edition  
```ruby  
target 'Example' do  
  use_frameworks!  
  pod 'CouchbaseLiteVectorSearch', '2.0.0' (1)  
end  
```

| **1** | Specify the required version number, here we use the latest version |
| ----- | ------------------------------------------------------------------- |
3. Install the pods and open the `.xcworkspace` file generated by CocoaPods, using:  
```bash  
pod install  
```

This tab explains how to include the CouchbaseLiteVectorSearch package within your app  
See: [Example 1](#case-1) | [Example 2](#case-2)

Example 3\. Use Case 1\. Include in Existing Swift Package

Here you'll add the `CouchbaseLiteVectorSearch` package as a dependency to your Parent Swift package.

1. Add the CouchbaseLiteVectorSearch package as a dependency by including the following in the parent package manifest:  
```swift  
dependencies: [  
  .package(name: "CouchbaseLiteVectorSearch",  
    url: "https://github.com/couchbase/couchbase-lite-vector-search-spm.git",  
    from: "2.0.0"),  
  ],  
```
2. Add the dependent package product name to the target:  
```swift  
targets: [  
  .target(name: "ParentPackage",  
     dependencies: ["CouchbaseLiteVectorSearch"]),  
]  
```
3. CouchbaseliteVectorSearch will be automatically detected and loaded in when creating a CouchbaseLite database object.

Example 4\. Use Case 2\. Include in Your App Project

Here you'll add `CouchbaseLiteVectorSearch` directly into your app.

1. Open the project to which you are going to add CouchbaseLiteVectorSearch
2. Open the Project Editor to add a dependency

  1. In _Project Navigator_:  
**Select** your XCode project file (for example, `HostApp` in the example)  
  XCode opens the _Project Editor_ pane
  2. In the _Project Editor_ pane:  
**Select** **Project** **Swift Packages** and **+** to add the dependency  
  XCode opens the _Choose Package Repository_ dialog
3. In the _Choose Package Repository_ dialog:  
**Enter** the appropriate Couchbase Lite URL, **Next** to continue  
For Vector Search: <https://github.com/couchbase/couchbase-lite-vector-search-spm.git>
4. **Enter** the required **_Version_** (2.0.0) and **Next** to continue
5. **Finish** to close the _Choose Package Repository_ dialog

XCode displays the name, version and URL of the added CouchbaseLiteVectorSearch Package

1. Finally, you can enable the vector search extension using the following snippet:

```swift
        try Extension.enableVectorSearch()
```

> [!IMPORTANT]
> You must enable the extension before you open your database.

## [](#related-content)Related Content

###### [](#)

How to . . .

* [Prerequisites](gs-prereqs.md)
* [Install](gs-install.md)
* [Build and Run](gs-build.md)

.

###### [](#-2)

Learn more . . .

* [Databases](database.md)
* [Documents](document.md)
* [Blobs](blob.md)
* [Remote Sync Gateway](replication.md)
* [Handling Data Conflicts](conflict.md)

.

###### [](#-3)

Dive Deeper . . .

[Mobile Forum](https://forums.couchbase.com/c/mobile/14) | [Blog](https://blog.couchbase.com/) | [Tutorials](https://docs.couchbase.com/tutorials/)

.