Remove DataStore
Before adding Apollo, remove Amplify DataStore from your project.
Remove DataStore frameworks from your target
- In the Xcode Navigator panel (left sidebar), select the blue project icon at the very top (the document icon labeled with your project name). This opens the Project Editor.
- In the Project Editor, you will see two columns: PROJECT and TARGETS. Select your app name under TARGETS (not under PROJECT).
- Select the "General" tab at the top.
- Scroll down to the "Frameworks, Libraries, and Embedded Content" section (below "Supported Destinations" and "Minimum Deployments").
- Remove the DataStore-related frameworks by selecting each one and selecting the ⊖ (minus) button at the bottom of the list. Remove at minimum:
AWSDataStorePluginAWSAPIPlugin(if it was only used by DataStore)
Remove the DataStore plugin from app initialization
Remove the DataStore and API plugin registration from your Amplify configuration code:
// Remove these lines:try Amplify.add(plugin: AWSDataStorePlugin(modelRegistration: AmplifyModels()))try Amplify.add(plugin: AWSAPIPlugin(modelRegistration: AmplifyModels()))Keep any other plugins you still need (e.g., AWSCognitoAuthPlugin).
Delete DataStore generated model files
If you used Amplify codegen, delete the generated model classes. These are typically found in a Models/ directory and include files like:
Post.swiftPost+Schema.swiftAmplifyModels.swift
These will be replaced by Apollo's generated types.
Remove all Amplify.DataStore.* calls
Search your codebase and remove or replace all DataStore calls:
| DataStore Call | Apollo Replacement |
|---|---|
Amplify.DataStore.save() | Apollo mutations (see Migrate DataStore to Apollo) |
Amplify.DataStore.delete() | Apollo mutations (see Migrate DataStore to Apollo) |
Amplify.DataStore.query() | Apollo queries (see Migrate DataStore to Apollo) |
Amplify.DataStore.observe() | Apollo subscriptions (see Migrate DataStore to Apollo) |
Amplify.DataStore.observeQuery() | Apollo cache watchers (see Migrate DataStore to Apollo) |
Amplify.DataStore.clear() | apolloClient.store.clearCache() |
Amplify.DataStore.start() / .stop() | No longer needed |