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).
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
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.
Recommended change:
.gitignore
file inside
ios
folder with
this changesRecommended 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.