Capacitor 2.0 is just released!
Developers use Capacitor as a native app container for packaging and deploying their Ionic apps to various mobile and desktop platforms. The capacitor allows them to access native features like the Camera using the same code across all platforms – without having to worry about platform-specific details.
This new version updates Capacitor and its project templates to the latest security, bug fixes, and features including:
- Swift 5 and Xcode 11+ support
- Android 10 (SDK 29) and AndroidX support, which makes Face Unlock and Iris Unlock available now in Ionic Identity Vault.
- Bug fixes and usability improvements to 23+ core plugins
Traditionally, web developers have turned to tools like Apache Cordova/Adobe PhoneGap to deploy their web apps to other platforms. This worked well for many years, with Ionic recommending Cordova as the default method for targeting native iOS and Android platforms. Over time our opinions changed about how this layer should work and after exploring various ideas, determined the best option was to bring the native runtime component of app building in-house.
Now a key part of the Ionic Platform, Capacitor makes it easy for web developers to reuse their skills to build quality apps for all platforms, while significantly lessening the likelihood that they’ll get stuck on native-specific issues. You can learn more about how Capacitor compares with Cordova in this article penned by Max.
Capacitor 2.0 updates its underlying technology to support the latest versions of programming languages and operating systems that power all Capacitor apps, enabling improved performance, security, and modern development experiences. Specifically, support for the latest tech from iOS and Android is now available.
Swift 5 and Xcode 11+
On the iOS front, this means Swift 5 and Xcode 11+ support. This brings smaller app bundle sizes, modern development tooling and features, and compatibility with earlier versions of Swift.
Android 10 (SDK 29) and AndroidX
On Android, this means Android 10 (aka SDK 29), with improved security and biometrics, audio/video capabilities, and system-wide dark mode.
Additionally, AndroidX, the next generation of the Android Support Library, is now supported. Both provide Android developers with a standard way to provide users with newer features on earlier versions of Android or graceful fallback when unavailable.
AndroidX replaces the Support Library, providing feature parity and backward-compatibility while also bringing improvements to library modularity, smaller code size, and a better developer experience.
Whether you’re a consumer of Capacitor or a plugin author, you simply need to update your projects (or CLI) to access these new capabilities (see below).
Improved Plugins, Tooling, and Docs
Capacitor 1.0 wouldn’t have been as successful as it has been without a solid developer experience backing it. With Capacitor 2.0, we’ve reviewed it from head to toe, leading to updates to the core plugins, the CLI tooling, and documentation.
Fundamentally, if you’re going to build unique app experiences, you need a reliable set of plugins to build on top of. Capacitor 2.0 includes many updates to its 23 core plugins, from bug fixes to new features to usability improvements. Many of these changes were driven by feedback from you, the Ionic community, so thank you! We appreciate your efforts and feedback – it helps us ensure that it’s never been easier to get started with Capacitor.
Speaking of awesome community efforts, Ionic’s official tool for generating splash screens and icons, cordova-res, just got a big update: Capacitor support! Thanks to wanna dream for this contribution.
npm i -g cordova-res cordova-res --skip-config --copy
Capacitor’s embrace of native tooling means that it’s never been easier to implement more creative native features. That said, the nuances and details can be challenging, so we’ve begun to add new implementation guides to the Capacitor docs, including Deep Links, Sign In with Apple, and a refreshed Push Notifications with Firebase guide. There are more coming soon – if there’s content you think is missing, please let us know in the comments.
Android Face Unlock & Iris Unlock
In order to protect your user’s data, you need to keep up with the latest mobile security features. Security is traditionally challenging to implement correctly – with disastrous results if done wrong.
With the new support of AndroidX in Capacitor 2.0, Ionic Identity Vault now supports Android’s Face Unlock and Iris Unlock. This update to Ionic’s all-in-one frontend identity management system brings industry-leading facial and iris authentication features to the Android platform. Using a simple API, you can add top of the line biometric authentication to your Capacitor apps. Learn more here.
Backward compatibility with Cordova
Capacitor 2.0 maintains near 100% backward compatibility with Cordova (available since the project originally launched). Not only does this ensure a smooth migration from Cordova to Capacitor, but it also provides access to thousands of existing native plugins. Learn how to use Cordova plugins here.
Easy Update Process
Capacitor gives Ionic developers complete control of their native projects. Among many other benefits, this makes updating easy and straightforward.
First, update Capacitor Core and the CLI:
cd your-app-folder npm install @capacitor/cli@latest npm install @capacitor/core@latest
Next, update each Capacitor library in use:
npm install @capacitor/ios@latest npx cap sync ios npm install @capacitor/android@latest # Within Android Studio, click "Sync Project with Gradle Files" button cd electron npm install @capacitor/electron@latest
Then, follow these update instructions which cover one-time manual steps:
- Breaking Changes
More than a version number
Capacitor 2.0 is a significant update to an increasingly important part of Ionic’s app development platform.
We’ve been blown away by the reception of Capacitor since it was announced, and installs have been growing quickly.
With 2.0, we are starting to make Capacitor the default for all new Ionic React and soon Ionic Angular projects, and expect us to be recommending Capacitor for all new Ionic apps and increasingly for enterprise apps as well.
Additionally, we are dedicating more internal resources to Capacitor as it becomes a key part of the Ionic offering. Expect to see Capacitor receive a lot more focus and attention from us in the coming months.
For more information and to develop mobile apps using Ionic, Hire Ionic Developer from us as we give you a high-quality product by utilizing all the latest tools and advanced technology. E-mail us any clock at – email@example.com or Skype us: “hkinfosoft”. To develop Mobile Apps using Ionic, please visit our technology page.