NitroSQLite

iOS

Database storage, app groups, and CocoaPods overrides.

See Configuration for shared package.json settings.

Database location

Databases use Documents by default. To use Library/Application Support, add this to your app's Info.plist:

<key>RNNitroSQLite_DatabaseLocation</key>
<string>ApplicationSupport</string>

Existing databases and their sidecar files move when next opened or attached. Switching back to Documents does not move them back. See file locations for the location option.

App groups

Enable the App Groups capability for your app and extension, then add the group identifier to Info.plist:

<key>RNNitroSQLite_AppGroup</key>
<string>group.example.shared</string>

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

Bundled or system SQLite

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.

Thread safety and performance mode

For one Pod installation, NITRO_SQLITE_THREADSAFE and NITRO_SQLITE_PERFORMANCE_MODE override the corresponding package.json settings. Both accept true, false, 1, or 0.

Additional compile flags

To enable FTS5 full-text search, add this inside your existing post_install block in ios/Podfile:

installer.pods_project.targets.each do |target|
  next unless target.name == 'RNNitroSQLite'

  target.build_configurations.each do |config|
    definitions = Array(config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] || '$(inherited)')
    config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = definitions + ['SQLITE_ENABLE_FTS5=1']
  end
end

Install react-native-nitro-sqlite-vec, then run:

NITRO_SQLITE_VEC=1 npx pod-install

Rebuild and follow the vector search guide. For SEE build settings, see encryption.