Updating Your Capacitor iOS Project
Occasionally, you'll need to make Capacitor updates to your iOS app, including updating the version of Capacitor used in your app, or using new ways of interfacing with Capacitor inside of your iOS codebase (for example, with new iOS API changes).
Updating Capacitor iOS Library
To update the version of @capacitor/ios used in your app, just npm install latest version:
npm install @capacitor/ios@2
Then sync the native project:
npx cap sync ios
Updating iOS Project
To update the base structure of your Xcode project, view the ios-template project in the Capacitor repo, under the tag corresponding to the latest stable release of Capacitor. The core project is kept simple on purpose: it shouldn't take much time to see what is different from the core project and your project.
In particular, AppDelegate.swift should be checked regularly for possible changes to iOS events.
From 1.0.0 to 1.1.0
Recommended change:
- Update
.gitignore
file insideios
folder with this changes
From <= 1.5.1 to 2.0.0
Recommended change:
-
Update native project to Swift 5
Capacitor 2.0 uses Swift 5, it's recommended to update your native project to also use Swift 5. To do so, from Xcode click
Edit -> Convert -> To Current Swift Syntax
.App.app will appear selected, click
Next
button.Then a message will say
No source changes necessary
.Finally, click the
Update
button.
For API changes, check the Release Notes.