iOS
Database storage, app groups, and Swift Package Manager build options.
The database directory and app group settings apply to both React Native and NitroUI. The Swift Package Manager overrides below belong to react-native-nitro-sqlite. See supported platforms for host requirements.
Set up Swift Package Manager
If Expo generates your native project, follow the Expo prebuild setup.
In every build configuration of your Xcode app target, set IPHONEOS_DEPLOYMENT_TARGET to a literal version of 16.0 or later. React Native 0.88 uses the lowest configuration value for the SwiftPM autolinking package. It does not expand references such as $(CUSTOM_IOS_FLOOR) and can fall back to 15.1.
After setting the deployment target, run npx react-native spm from your app directory. If React Native is still integrated through CocoaPods, run npx react-native spm add --deintegrate instead.
Keep other CocoaPods
To keep non-React-Native pods after migration, remove the remaining React Native setup from the Podfile, including any leftover arguments and the react_native_post_install call. Keep your other pod declarations, run pod install from ios, then open the .xcworkspace. React Native includes the migration checklist in node_modules/react-native/scripts/spm/__docs__/spm-scripts.md.
If CocoaPods warns about custom base configurations, use an app-owned .xcconfig for each affected configuration. Include the matching generated Pods .xcconfig first, then include ReactNativeSPM/ReactNativeSPM.xcconfig, so Xcode picks up both sets of build settings.
React Native 0.88 refuses a plain SwiftPM update while CocoaPods is integrated. To refresh SwiftPM in this setup, run npx react-native spm add --deintegrate again, then reinstall the retained pods.
Database location
Databases use Documents by default. To use Library/Application Support, add this to your app's Info.plist:
<key>NitroSQLite_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.
RNNitroSQLite_DatabaseLocation remains supported when NitroSQLite_DatabaseLocation is absent. If both keys exist, NitroSQLite_DatabaseLocation wins. Renaming the key without changing its value uses the same directory and does not move databases.
The selected value must be a string. A non-string value throws an error that names the key, including when the legacy key has a valid value.
App groups
Enable the App Groups capability for your app and extension, then add the group identifier to Info.plist:
<key>NitroSQLite_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.
RNNitroSQLite_AppGroup remains supported when NitroSQLite_AppGroup is absent. If both keys exist, NitroSQLite_AppGroup wins. Both key names resolve the same group identifier to the same container.
The selected group identifier must be a string. A non-string value throws an error that names the key.
Build settings
For React Native, 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 or Expo’s generated ios/Podfile.properties.json require a refresh. After changing them, delete ~/Library/Caches/org.swift.swiftpm/manifests and rebuild.
Bundled or system SQLite
To use system SQLite in React Native, 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.
Apple’s SQLite can enable legacy table renaming. If a migration renames a table referenced by a view or trigger, run PRAGMA legacy_alter_table = OFF on that connection before ALTER TABLE ... RENAME TO. SQLite will update those references as part of the rename. See SQLite’s table rename behavior.
Thread safety and performance mode
In React Native builds, NITRO_SQLITE_THREADSAFE and NITRO_SQLITE_PERFORMANCE_MODE override the corresponding package.json settings. Set them in the build command's environment. Both accept true, false, 1, or 0.
Additional compile flags
For React Native, 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:
{
"nitroSQLite": {
"iosSqliteFlags": "-DSQLITE_ENABLE_FTS5=1"
}
}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.
NitroUI uses its adapter's own Package.swift and does not read these React Native build overrides. See NitroUI build settings.
Vector search
Use bundled SQLite for vector search. Apple's system SQLite does not support the automatic extension registration that sqlite-vec uses.
In React Native, install react-native-nitro-sqlite-vec, then refresh the Swift packages from your app directory:
npx react-native spmRebuild and follow the vector search guide. For SEE build settings, see encryption.