Skip to content

Commit 0a450ca

Browse files
chrispaderclaude
andcommitted
docs: document the Nitro V1 setup
Update the installation steps, the iOS configuration page and the encryption guide for Nitro V1 and Swift Package Manager, including the nitroSQLite.iosSqliteFlags setting and the manifest cache that applies package.json changes only after it's cleared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent db33c48 commit 0a450ca

7 files changed

Lines changed: 47 additions & 31 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ If you use a coding agent, give it the [NitroSQLite skill](https://github.com/ma
1818

1919
## Installation
2020

21-
Requires React Native 0.75 or newer and `react-native-nitro-modules` 0.37.1 or newer.
21+
Requires React Native 0.88 or newer and Nitro V1. iOS builds use Swift Package Manager and require Xcode with Swift 6.4 or newer.
2222

2323
```sh
24-
npm install react-native-nitro-sqlite react-native-nitro-modules
24+
npm install react-native-nitro-sqlite react-native-nitro-modules@1.0.0-alpha.nightly.86.g15e19db42041
25+
npx react-native spm
2526
```
2627

2728
Rebuild the native app after installing. Expo projects need a development build; Expo Go cannot load this native module. See [Getting Started](https://sqlite.margelo.com/docs) for details.

‎docs/content/docs/configuration/index.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Add the options you want to change to your app's `package.json`. These are the d
1515
}
1616
```
1717

18-
All values are booleans. Rebuild your app after changes; on Apple platforms, install Pods again first.
18+
All values are booleans. Rebuild your app after changes. On iOS, Swift Package Manager caches the package manifest that reads these settings, so delete `~/Library/Caches/org.swift.swiftpm/manifests` before rebuilding. On macOS, install Pods again first.
1919

2020
## Thread safety
2121

‎docs/content/docs/configuration/ios.mdx‎

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: iOS
3-
description: Database storage, app groups, and CocoaPods overrides.
3+
description: Database storage, app groups, and Swift Package Manager build options.
44
---
55

66
<span id="rtree-support" />
@@ -29,35 +29,38 @@ Enable the App Groups capability for your app and extension, then add the group
2929

3030
The group container takes precedence over the database location setting. An invalid or inaccessible container causes initialization to throw.
3131

32+
## Build settings
33+
34+
Swift Package Manager reads the SQLite build settings when it resolves Nitro SQLite's package, and it caches the result. Changed environment variables are picked up automatically, but changes to [`package.json` settings](/docs/configuration) are not. After changing them, delete `~/Library/Caches/org.swift.swiftpm/manifests` and rebuild.
35+
3236
## Bundled or system SQLite
3337

34-
To use system SQLite instead of the bundled library, install Pods with `NITRO_SQLITE_USE_PHONE_VERSION=1`. The shared build settings cannot change system SQLite's capabilities.
38+
To use system SQLite instead of the bundled library, set `NITRO_SQLITE_USE_PHONE_VERSION=1` in the environment of the command that builds the app, for example `NITRO_SQLITE_USE_PHONE_VERSION=1 npx react-native run-ios`. Builds started from the Xcode app do not read your shell environment. The shared build settings cannot change system SQLite's capabilities.
3539

3640
## Thread safety and performance mode
3741

38-
For one Pod installation, `NITRO_SQLITE_THREADSAFE` and `NITRO_SQLITE_PERFORMANCE_MODE` override the corresponding [`package.json` settings](/docs/configuration). Both accept `true`, `false`, `1`, or `0`.
42+
When set in the environment of the command that builds the app, `NITRO_SQLITE_THREADSAFE` and `NITRO_SQLITE_PERFORMANCE_MODE` override the corresponding [`package.json` settings](/docs/configuration). Both accept `true`, `false`, `1`, or `0`.
3943

4044
## Additional compile flags
4145

42-
To enable FTS5 full-text search, add this inside your existing `post_install` block in `ios/Podfile`:
46+
Use `iosSqliteFlags` in your app's `package.json` for additional SQLite features or to override individual build defaults. For example, to enable FTS5 full-text search:
4347

44-
```ruby
45-
installer.pods_project.targets.each do |target|
46-
next unless target.name == 'RNNitroSQLite'
47-
48-
target.build_configurations.each do |config|
49-
definitions = Array(config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] || '$(inherited)')
50-
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = definitions + ['SQLITE_ENABLE_FTS5=1']
51-
end
52-
end
48+
```json
49+
{
50+
"nitroSQLite": {
51+
"iosSqliteFlags": "-DSQLITE_ENABLE_FTS5=1"
52+
}
53+
}
5354
```
5455

56+
The value accepts only `-DNAME` and `-DNAME=VALUE` definitions, separated by spaces. Custom definitions take precedence over the defaults from your other `package.json` settings.
57+
5558
## Vector search
5659

57-
Install `react-native-nitro-sqlite-vec`, then run:
60+
Install `react-native-nitro-sqlite-vec`, then refresh the Swift packages from your app directory:
5861

5962
```sh
60-
NITRO_SQLITE_VEC=1 npx pod-install
63+
npx react-native spm
6164
```
6265

6366
Rebuild and follow the [vector search guide](/docs/integrations/vector-search). For SEE build settings, see [encryption](/docs/guides/encryption).

‎docs/content/docs/guides/encryption.mdx‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,17 @@ Pass `encryptionKey` to `open()` to use an encrypted database. This requires a n
2222
nitroSqliteFlags="-DSQLITE_ENABLE_SEE=1"
2323
```
2424

25-
On Apple platforms, add the definition to the `RNNitroSQLite` target inside your existing Podfile `post_install` block:
25+
On iOS, set this in your app's `package.json`:
26+
27+
```json
28+
{
29+
"nitroSQLite": {
30+
"iosSqliteFlags": "-DSQLITE_ENABLE_SEE=1"
31+
}
32+
}
33+
```
34+
35+
On macOS, add the definition to the `RNNitroSQLite` target inside your existing Podfile `post_install` block:
2636

2737
```ruby
2838
installer.pods_project.targets.each do |target|
@@ -35,7 +45,7 @@ Pass `encryptionKey` to `open()` to use an encrypted database. This requires a n
3545
end
3646
```
3747

38-
Use the bundled SQLite build on Apple platforms. `NITRO_SQLITE_USE_PHONE_VERSION=1` links the system SQLite library, which does not include your SEE source. Install Pods again and rebuild the native app after changing the source or flags. See [iOS configuration](/docs/configuration/ios#additional-compile-flags) and [Android configuration](/docs/configuration/android#sqlite-compile-flags) for the platform build settings.
48+
Use the bundled SQLite build on Apple platforms. `NITRO_SQLITE_USE_PHONE_VERSION=1` links the system SQLite library, which does not include your SEE source. Rebuild the native app after changing the source or flags. On iOS, delete `~/Library/Caches/org.swift.swiftpm/manifests` first, so Swift Package Manager reads the new flags. On macOS, install Pods again first. See [iOS configuration](/docs/configuration/ios#additional-compile-flags) and [Android configuration](/docs/configuration/android#sqlite-compile-flags) for the platform build settings.
3949

4050
## Open an encrypted database
4151

‎docs/content/docs/guides/migrate-from-quick-sqlite.mdx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ description: Move from react-native-quick-sqlite 8.x to the Nitro SQLite 9.x pac
99

1010
```sh
1111
npm uninstall react-native-quick-sqlite
12-
npm install react-native-nitro-sqlite react-native-nitro-modules
13-
npx pod-install
12+
npm install react-native-nitro-sqlite react-native-nitro-modules@1.0.0-alpha.nightly.86.g15e19db42041
13+
npx react-native spm
1414
```
1515

16+
See [Getting Started](/docs) for the platform requirements and the Swift Package Manager setup on iOS.
17+
1618
## Update calls to use a connection
1719

1820
The recommended 9.x API is the connection returned by `open()`. It binds the database name once, so query calls on that connection no longer pass the name each time:

‎docs/content/docs/index.mdx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ Nitro SQLite gives React Native apps a local SQLite database on iOS, macOS, visi
77

88
## 1. Install the packages
99

10-
Nitro SQLite requires React Native 0.75 or newer, React 17 or newer, and `react-native-nitro-modules` 0.37.1 or newer.
10+
Nitro SQLite is built with Nitro V1, which requires React Native 0.88 or newer with the New Architecture. iOS builds require Xcode with Swift 6.4 or newer. Install the Nitro version that Nitro SQLite was built with, because the generated native bindings must match it:
1111

1212
```sh
13-
npm install react-native-nitro-sqlite react-native-nitro-modules
13+
npm install react-native-nitro-sqlite react-native-nitro-modules@1.0.0-alpha.nightly.86.g15e19db42041
1414
```
1515

1616
## 2. Set up the native project
1717

18-
The default database location needs no custom SQLite settings. If your project has an `ios` directory, install the native pods after adding the packages:
18+
The default database location needs no custom SQLite settings. Nitro V1 builds iOS dependencies with Swift Package Manager. If your project has an `ios` directory, set up or refresh the Swift packages from your app directory after adding the packages:
1919

2020
```sh
21-
npx pod-install
21+
npx react-native spm
2222
```
2323

24-
Android needs no additional Nitro SQLite configuration for the default setup. For a React Native macOS project, install CocoaPods from its `macos` directory. Use [Configuration](/docs/configuration) for the shared `package.json` options. The [iOS](/docs/configuration/ios), [Android](/docs/configuration/android), and [macOS](/docs/configuration/macos) pages cover platform settings and build alternatives.
24+
If your iOS project still uses CocoaPods, convert it first with `npx react-native spm add --deintegrate`. Android needs no additional Nitro SQLite configuration for the default setup. For a React Native macOS project, install CocoaPods from its `macos` directory. Use [Configuration](/docs/configuration) for the shared `package.json` options. The [iOS](/docs/configuration/ios), [Android](/docs/configuration/android), and [macOS](/docs/configuration/macos) pages cover platform settings and build alternatives.
2525

2626
## 3. Rebuild the app
2727

‎packages/react-native-nitro-sqlite-vec/README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ Opt-in [sqlite-vec](https://github.com/asg017/sqlite-vec) support for [`react-na
44

55
## Installation
66

7-
Install both this package and `react-native-nitro-sqlite`, then enable the native build flag.
7+
Install both this package and `react-native-nitro-sqlite`, then enable it in the native build.
88

99
```bash
1010
npm install react-native-nitro-sqlite react-native-nitro-sqlite-vec
1111
```
1212

13-
- **Apple platforms (iOS, macOS, visionOS):**
13+
- **iOS:** refresh the Swift packages from your app directory:
1414
```bash
15-
NITRO_SQLITE_VEC=1 npx pod-install
15+
npx react-native spm
1616
```
17-
For React Native macOS, run `NITRO_SQLITE_VEC=1 pod install` from `macos/`.
17+
- **macOS:** run `NITRO_SQLITE_VEC=1 pod install` from `macos/`.
1818
- **Android:** add this to `android/gradle.properties` and rebuild:
1919
```properties
2020
nitroSqliteVec=true

0 commit comments

Comments
 (0)