
appmigrationkit
Transfer app data to or from other platforms using AppMigrationKit. Use when implementing system-orchestrated one-time migration between iOS and Android or another platform, building an AppMigrationExtension, packaging transportable resources with ResourcesArchiver, importing resources on the destination device, reporting import progress, handling migration errors and app group cleanup, checking MigrationStatus, or testing migration code with AppMigrationTester.
- Installs
- 3K
- Last 24h
- +15
- Trending rank
- #7084
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/dpearson2699/swift-ios-skills --skill appmigrationkit- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads appmigrationkit automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
AppMigrationKit
One-time cross-platform data transfer for app resources. Enables apps to export data to or import data from another platform (for example, Android) during device setup or onboarding. AppMigrationKit APIs are iOS 26.0+ / iPadOS 26.0+; the data-container entitlement is iOS 26.1+ / iPadOS 26.1+ / Mac Catalyst 26.1+. Swift 6.3.
Beta-sensitive. AppMigrationKit is new in iOS 26 and may change before GM. Re-check current Apple documentation before relying on specific API details.
AppMigrationKit uses an app extension model. The system orchestrates the transfer between devices. The app provides an extension conforming to export and import protocols, and the system calls that extension at the appropriate time. The app itself never manages the network connection between devices.
Contents
- Architecture Overview
- Setup and Entitlements
- App Migration Extension
- Exporting Resources
- Importing Resources
- Migration Status
- Progress Tracking
- Testing
- Common Mistakes
- Review Checklist
- References
Architecture Overview
AppMigrationKit operates through three layers:
- App extension -- An
AppMigrationExtensionconforming type that the system invokes during migration. It handles data export and import. - System orchestration -- The OS manages the device-to-device session, transport, and scheduling. The extension does not control when it runs.
- Containing app -- After migration completes, the app checks
MigrationStatus.importStatuson first launch to determine whether migration occurred and whether it succeeded.
Key types:
| Type | Role |
|---|---|
AppMigrationExtension | Protocol for the app extension entry point |
ResourcesExportingWithOptions | Protocol for exporting files via archiver |
ResourcesExporting | Simplified export protocol (no custom options) |
ResourcesImporting | Protocol for importing files on the destination |
ResourcesArchiver | Streams files into the export archive |
MigrationDataContainer | Access to the containing app's data directories |
MigrationStatus | Check import result from the containing app |
MigrationPlatform | Identifies the other device's platform (e.g., .android) |
MigrationAppIdentifier | Identifies the source app by store and bundle ID |
AppMigrationTester | Test-only actor for validating export/import logic |
Setup and Entitlements
Entitlement
The app extension requires the com.apple.developer.app-migration.data-container-access
entitlement. Its value is a single-element string array containing the bundle
identifier of the containing app:
<key>com.apple.developer.app-migration.data-container-access</key>
<array>
<string>com.example.myapp</string>
</array>
No other values are valid. This entitlement grants the extension read access to the containing app's data container during export and write access during import. The entitlement itself is available on iOS 26.1+, iPadOS 26.1+, and Mac Catalyst 26.1+, even though the core AppMigrationKit APIs are available on iOS 26.0+ and iPadOS 26.0+.
Extension Target
Add a new App Extension target to the Xcode project. The extension conforms
to one or more of the migration protocols (ResourcesExportingWithOptions,
ResourcesExporting, ResourcesImporting).
App Migration Extension
The extension entry point conforms to AppMigrationExtension. During
migration, the system prevents launching the containing app and its other
extensions to ensure exclusive data access.
Accessing the Data Container
The extension accesses the containing app's files through appContainer:
import AppMigrationKit
struct MyMigrationExtension: ResourcesExporting {
var resourcesSizeEstimate: Int { estimateTotalExportSize() }
var resourcesVersion: String { "1.0" }
var resourcesCompressible: Bool { true }
func exportResources(
to archiver: sending ResourcesArchiver,
request: MigrationRequest
) async throws {
let container = appContainer
// container.bundleIdentifier -- app's bundle ID
// container.containerRootDirectory -- root of the app container
// container.documentsDirectory -- Documents/
// container.applicationSupportDirectory -- Application Support/
}
}
MigrationDataContainer provides containerRootDirectory, documentsDirectory,
and applicationSupportDirectory as URL values pointing into the containing
app's sandbox.
Exporting Resources
Conform to ResourcesExportingWithOptions (or ResourcesExporting for no
custom options) to package files for transfer. The system calls
exportResources(to:request:) with a ResourcesArchiver and a
MigrationRequestWithOptions.
Declaring Export Properties
struct MyMigrationExtension: ResourcesExportingWithOptions {
typealias OptionsType = MigrationDefaultSupportedOptions
var resourcesSizeEstimate: Int {
// Return estimated total bytes of exported data
calculateExportSize()
}
var resourcesVersion: String {
"1.0"
}
var resourcesCompressible: Bool {
true // Let the system compress during transport
}
}
resourcesSizeEstimate-- Estimated total bytes. The system uses this for progress UI and free-space checks.resourcesVersion-- Format version string. The import side receives this to handle versioned data formats.resourcesCompressible-- Whentrue, the archiver may compress files during transport.
Implementing Export
func exportResources(
to archiver: sending ResourcesArchiver,
request: MigrationRequestWithOptions<MigrationDefaultSupportedOptions>
) async throws {
let docsDir = appContainer.documentsDirectory
// Check destination platform if needed
if request.destinationPlatform == .android {
// Platform-specific export logic
}
// Append files one at a time -- make continuous progress
let userDataURL = docsDir.appending(path: "user_data.json")
try await archiver.appendItem(at: userDataURL)
// Append with a custom archive path
let settingsURL = docsDir.appending(path: "settings.plist")
try await archiver.appendItem(at: settingsURL, pathInArchive: "preferences/settings.plist")
// Append a directory
let photosDir = docsDir.appending(path: "photos")
try await archiver.appendItem(at: photosDir, pathInArchive: "media/photos")
}
The archiver streams files incrementally. Call appendItem(at:pathInArchive:)
repeatedly as each resource is ready. The system may terminate the extension
if it appears hung, so avoid long gaps between append calls.
Cancellation
ResourcesArchiver handles task cancellation automatically by throwing
cancellation errors. Do not catch these errors -- doing so causes the system
to kill the extension.
Migration Platform
MigrationRequestWithOptions exposes destinationPlatform as a
MigrationPlatform value. Use this to tailor exported data:
if request.destinationPlatform == .android {
// Export in a format the Android app expects
}
MigrationPlatform provides .android as a static constant. Custom
platforms can be created with MigrationPlatform("customPlatform").
Importing Resources
Conform to ResourcesImporting to receive transferred files on the
destination device. The system calls importResources(at:request:) after
app installation but before the app is launchable.
struct MyMigrationExtension: ResourcesImporting {
func importResources(
at importedDataURL: URL,
request: ResourcesImportRequest
) async throws {
let sourceVersion = request.sourceVersion
let sourceApp = request.sourceAppIdentifier
// sourceApp.platform -- e.g., .android
// sourceApp.bundleIdentifier -- source app's bundle ID
// sourceApp.storeIdentifier -- e.g., .googlePlay
// Copy imported files into the app container
let docsDir = appContainer.documentsDirectory
let userData = importedDataURL.appending(path: "user_data.json")
if FileManager.default.fileExists(atPath: userData.path()) {
try FileManager.default.copyItem(
at: userData,
to: docsDir.appending(path: "user_data.json")
)
}
}
}
Error Handling During Import
On import error, the system clears the containing app's data container to prevent partial state. However, app group containers are not cleared. The import implementation should clear any app group containers before writing imported content:
func importResources(
at importedDataURL: URL,
request: ResourcesImportRequest
) async throws {
// Clear shared app group data first
let groupURL = FileManager.default.containerURL(
forSecurityApplicationGroupIdentifier: "group.com.example.myapp"
)
if let groupURL {
try? FileManager.default.removeItem(at: groupURL.appending(path: "shared_data"))
}
// Then import
try await performImport(from: importedDataURL)
}
Source App Identifier
ResourcesImportRequest provides sourceAppIdentifier as a
MigrationAppIdentifier with three properties:
platform-- The source device's platform (e.g.,.android)bundleIdentifier-- The source app's bundle identifierstoreIdentifier-- The app store (e.g.,.googlePlay)
Migration Status
After migration completes, the containing app checks the result on first launch:
import AppMigrationKit
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
if let status = MigrationStatus.importStatus {
switch status {
case .success:
showMigrationSuccessUI()
MigrationStatus.clearImportStatus()
case .failure(let error):
showMigrationFailureUI(error: error)
MigrationStatus.clearImportStatus()
}
}
return true
}
MigrationStatus.importStatusisnilif no migration occurred.- Call
clearImportStatus()after handling the result to prevent showing the notification on subsequent launches. - The enum has two cases:
.successand.failure(any Error).
Progress Tracking
The import side exposes a Progress object via resourcesImportProgress.
The system uses this to display transfer progress to the user. Update
completedUnitCount incrementally during import:
struct MyMigrationExtension: ResourcesImporting {
private let importProgress = Progress(totalUnitCount: 100)
var resourcesImportProgress: Progress { importProgress }
func importResources(
at importedDataURL: URL,
request: ResourcesImportRequest
) async throws {
let files = try FileManager.default.contentsOfDirectory(
at: importedDataURL, includingPropertiesForKeys: nil
)
let increment = Int64(100 / max(files.count, 1))
for file in files {
try processFile(file)
importProgress.completedUnitCount += increment
}
importProgress.completedUnitCount = 100
}
}
Testing
AppMigrationTester is a test-only actor for validating migration logic
in unit tests hosted by the containing app. Do not use it in production.
import Testing
import AppMigrationKit
@Test func testExportImportRoundTrip() async throws {
let tester = try await AppMigrationTester(platform: .android)
// Export
let result = try await tester.exportController.exportResources(
request: nil, progress: nil
)
#expect(result.exportProperties.uncompressedBytes > 0)
// Import the exported data
try await tester.importController.importResources(
from: result.extractedResourcesURL,
importRequest: nil, progress: nil
)
try await tester.importController.registerImportCompletion(with: .success)
}
DeviceToDeviceExportProperties on the result exposes uncompressedBytes,
compressedBytes (nil if not compressible), sizeEstimate, and version.
See references/appmigrationkit-patterns.md for additional test patterns.
Common Mistakes
DON'T: Catch cancellation errors from ResourcesArchiver
// WRONG -- system kills the extension if cancellation is swallowed
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
do {
try await archiver.appendItem(at: fileURL)
} catch is CancellationError {
// Swallowing this causes termination
}
}
// CORRECT -- let cancellation propagate
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
try await archiver.appendItem(at: fileURL)
}
DON'T: Leave long gaps between archiver append calls
// WRONG -- system may assume the extension is hung and terminate it
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
let allFiles = gatherAllFiles() // Takes 30 seconds
for file in allFiles {
try await archiver.appendItem(at: file)
}
}
// CORRECT -- interleave file preparation with archiving
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
for file in knownFilePaths() {
try await archiver.appendItem(at: file)
}
}
DON'T: Convert files to intermediate format during export
// WRONG -- may exhaust disk space creating temporary copies
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
let converted = try convertToJSON(originalDatabase) // Doubles disk usage
try await archiver.appendItem(at: converted)
}
// CORRECT -- export files as-is, convert on import side if needed
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
try await archiver.appendItem(at: originalDatabase)
}
DON'T: Ignore app group containers during import error recovery
// WRONG -- system clears app container but not app groups on error
func importResources(at url: URL, request: ResourcesImportRequest) async throws {
try writeToAppGroup(data)
try writeToAppContainer(data) // If this throws, app group has stale data
}
// CORRECT -- clear app group data before importing
func importResources(at url: URL, request: ResourcesImportRequest) async throws {
try clearAppGroupData()
try writeToAppGroup(data)
try writeToAppContainer(data)
}
DON'T: Forget to clear import status after handling it
// WRONG -- migration UI shows every launch
if let status = MigrationStatus.importStatus {
showMigrationResult(status)
// Missing clearImportStatus()
}
// CORRECT
if let status = MigrationStatus.importStatus {
showMigrationResult(status)
MigrationStatus.clearImportStatus()
}
Review Checklist
- Extension target added with
com.apple.developer.app-migration.data-container-accessentitlement - Entitlement array contains exactly one string: the containing app's bundle identifier
- Extension conforms to
ResourcesExportingWithOptionsorResourcesExportingfor export - Extension conforms to
ResourcesImportingfor import -
resourcesSizeEstimatereturns a reasonable byte estimate -
resourcesVersionis set and will be checked on import for format compatibility - Export calls
appendItemincrementally without long pauses - Cancellation errors from
ResourcesArchiverare not caught - Import clears app group containers before writing new data
- Containing app checks
MigrationStatus.importStatuson first launch -
clearImportStatus()called after handling the migration result -
AppMigrationTesterused in unit tests to validate export and import - Files are exported as-is without intermediate format conversion on the export side
-
sourceVersionfrom import request used to handle versioned data formats
References
- Extended patterns (combined extension, versioned migration, file enumeration, error recovery): references/appmigrationkit-patterns.md
- AppMigrationKit framework
- AppMigrationExtension
- ResourcesExportingWithOptions
- ResourcesImporting
- ResourcesArchiver
- MigrationStatus
- MigrationDataContainer
- AppMigrationTester
- Data container entitlement
FAQ
What does the appmigrationkit skill do?
Transfer app data to or from other platforms using AppMigrationKit. Use when implementing system-orchestrated one-time migration between iOS and Android or another platform, building an AppMigrationExtension, packaging transportable resources with ResourcesArchiver, importing resources on the destination device, reporting import progress, handling migration errors and app group cleanup, checking MigrationStatus, or testing migration code with AppMigrationTester.
How do I install appmigrationkit?
Run npx skills add https://github.com/dpearson2699/swift-ios-skills --skill appmigrationkit in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/appmigrationkit/ (personal) or .claude/skills/appmigrationkit/ (project).
Which AI agents can use appmigrationkit?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is appmigrationkit safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains appmigrationkit?
It is published by dpearson2699 in dpearson2699/swift-ios-skills. It has 3,042 recorded installs.
More from dpearson2699/swift-ios-skills
swiftui-animation
dpearson2699/swift-ios-skills
Implement, diagnose, or review SwiftUI motion using explicit and scoped implicit animations, springs, transitions, PhaseAnimator, KeyframeAnimator, matched geometry or navigation zoom, SF Symbol effects, and custom Animation types. Use when views should animate on state changes, insertion, removal, navigation, or multi-step choreography, or when motion must respect Reduce Motion and Swift concurrency.
ios-accessibility
dpearson2699/swift-ios-skills
Build and audit SwiftUI, UIKit, and AppKit accessibility for VoiceOver, Voice Control, Switch Control, Full Keyboard Access, Dynamic Type, focus restoration, labels/traits/actions, traversal, custom rotors, NSAccessibility, XCTest checks, adaptive system preferences, and App Store accessibility declarations. Use when implementing accessible UI, fixing an accessibility audit, testing assistive-technology behavior, or substantiating App Store Accessibility Nutrition Labels.
swiftui-performance
dpearson2699/swift-ios-skills
Profile, diagnose, and remediate SwiftUI runtime performance using code review, Instruments, and repeatable measurements. Use when a SwiftUI screen renders slowly, scrolling or animations hitch, view bodies update excessively, list identity churns, layout work spikes, or broad Observation dependencies raise CPU cost. Covers evidence-based triage, SwiftUI Instruments lanes, lazy-container guardrails, state lifetime, and before/after verification.
swiftui-patterns
dpearson2699/swift-ios-skills
Builds and reviews SwiftUI views with modern MV architecture, state, composition, isolated previews, and migration guidance. Covers @Observable ownership, @State/@Bindable/@Environment wiring, view decomposition, ViewModifiers, environment values, .task loading, iOS 26+ handoffs, Writing Tools, clipboard availability, and performance. Use when structuring SwiftUI state, managing @Observable, composing views, previewing meaningful UI states, or correcting SwiftUI patterns.
app-store-review
dpearson2699/swift-ios-skills
Audits App Store submission readiness and rejection risk across current review guidelines, PrivacyInfo.xcprivacy and required-reason APIs, privacy labels, ATT, StoreKit payments, metadata, entitlements, widgets, and Live Activities. Use when preparing a submission, responding to rejection, reconciling privacy evidence, or separating upload blockers from cleanup.
ios-networking
dpearson2699/swift-ios-skills
Build, review, or improve networking code in iOS/macOS apps using URLSession with async/await, structured concurrency, and modern Swift patterns. Use when working with REST APIs, downloading files, uploading data, WebSocket connections, pagination, retry logic, request middleware, caching, background transfers, or network reachability monitoring. Also use when handling HTTP requests, API clients, network error handling, or data fetching in Swift apps.
Popular mobile skills
design-mobile-apps
designed-by-ai/skills
Design mobile app screens with Sleek, edit Sleek projects, and implement their designs in React Native or HTML.
ios-design
uizze.sh
Design and review iOS UI/UX for iPhone apps in SwiftUI, UIKit, or React Native. Use for mobile app design, screen redesigns, navigation flows, typography, forms, keyboard and safe-area layout, and accessibility checks. Apply Apple Human Interface Guidelines and consult real product references through the optional Uizze connection.
vercel-react-native-skills
vercel-labs/agent-skills
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
animate-expo
emilkowalski/skills
Build animations in React Native and Expo, making the decisions in the order that determines whether they feel right — should it animate, which thread it runs on, which properties, spring or timing, how the gesture hands off, how it degrades. Writes the implementation with Reanimated, Gesture Handler, Expo Router and expo-haptics. Use when animating anything in an Expo app, adding gestures, sheets, screen transitions, press feedback or haptics, or fixing motion that stutters on device. For web animation use animate.
xcode-project-setup
firebase/agent-skills
Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).
firebase-remote-config-basics
firebase/agent-skills
Manages Firebase Remote Config templates, feature flags, loading strategies, and SDKs (Android, iOS). Use when downloading/deploying remoteconfig JSON templates, managing version history/feature flags, setting in-app defaults, fetchAndActivate(), real-time listeners, or SDK setup. Don't use for Firebase Hosting, Auth, Firestore, Data Connect, Crashlytics, or App Hosting.