April 3, 2023
  • All
  • Announcements
  • Product
  • Capacitor

Announcing Capacitor 5.0 Beta

Conner Simmons

Product Team

Capacitor, our cross-platform native runtime, is used by thousands of development teams worldwide to build better digital experiences. Today, we’re excited to bring you the latest iteration –  Capacitor 5.0 (beta)!

This latest version of Capacitor brings with it a number of exciting improvements, from bug fixes to support for the latest policy changes for the Google Play Store and Apple App Store. 

This latest release has been a real labor of love. Our talented engineers worked tirelessly to be able to bring you all the latest and greatest. We also want to give a big shout-out to our awesome community members who inspired and contributed to some of these changes. 💙

(We’d also like to thank the Academy, our moms, etc etc…)

What’s new

Capacitor 5 brings with it a bunch of critical bug fixes and performance improvements, but don’t take our word for it. Here’s what’s changed: 

iOS

Status bar animation update

In an effort to remain consistent with the modern iOS design system, we changed the default animation for the status bar. Before, the default animation was slide. Now, we’ve moved over to fade.

API improvements to better support Swift plugins moving forward

Previous to updates, CAPBridgedPlugin protocol requirements were at the class level and not the instance level and getMethod was a required function. ​​After adjustments were made, the process of creating new Swift plugins became far more streamlined and opened up newer possibilities for additional plugin APIs in the future.

Cookie delimiter change

When accessing cookies through document.cookie previously, the separator for the data points was simply “;”. Proper separation would include a space after the delimiter, so that has been corrected to now be “; ”.

Android

Better null handling for HTTP headers and params

Prior to the change, the instantiation of the JSObject “assumed” that headers and params properties were being provided. That may not always be the case. Now, by implementing a failover for instances where those properties are not provided, we avoid potential downstream issues.

Switch to HTTPS by default for autocomplete support

Before making any changes to the androidScheme configuration, we found that autocompletion wasn’t working properly. To address this issue, the configuration object now looks for a provided androidScheme and if none is found, defaults to https to ensure autocomplete works as expected.

Additional support for Huawei devices

Huawei devices leverage their own webview and don’t use Google’s. By checking against Chrome’s webview versions, modern Huawei devices were left unsupported. With a bit of added logic, this issue has been resolved!

Why should I upgrade?

In case you missed it, starting in August 2023, new apps bound for the Google Play Store must target Android 13 (API level 33) or higher. Android 13 introduces new permission changes that would be incompatible with Capacitor v4 apps. To keep v4 apps running smoothly, it would require a bit of extra work on the native layer. Updating your Capacitor app and the corresponding plugins to their v5 counterparts takes away any potential burden on your end!

On the iOS and iPadOS front, there are also some changes. All iOS and iPadOS apps submitted to the App Store must be built with Xcode 14.1 and the iOS 16.1 SDK starting in April 2023. As a result, Capacitor 5 will require a minimum of Xcode 14.1.

We’re hard at work keeping Capacitor updated to ensure developers don’t have any trouble meeting the app store requirements. A migration to Capacitor 5 brings that peace of mind!

Get by with a little help from a friend

Because your friends here at Ionic like to make things as simple as possible for you, the team has put together a full migration doc to get your existing apps ready ahead of the deadlines. Don’t fret, it’s a quick and easy process!

To start, install the next version of the Capacitor CLI to your project using:

npm i -D @capacitor/cli@next

After that’s completed, run the following to have the CLI handle the migrations for you:

npx cap migrate

In the event that any steps for the migration are not able to be completed, additional information will be made available in the output in the terminal.

While you’re at it…

Missed our last few Ionic Shows? Then you may have missed some of the awesome additions to Capacitor this past year. 

We brought an HTTP plugin right into Capacitor’s core library. Say goodbye to any extra logic you may have implemented to circumvent CORS issues in the past!

Cookies may be a tasty treat, but the patching required to get native cookie support into Capacitor apps- not so much. Also folded into Capacitor’s core library is the new Cookies plugin. Managing these delicious bites of data is now a whole lot easier.

A Google Maps plugin is now officially supported by the Capacitor team! As one of the most requested plugins since the inception of Capacitor, this news was well received by the community. If you’re interested in a deep dive into how our engineers solved some of the most difficult pain points in bringing this plugin to market, you should give that blog post a read as well.

That’s all for now! We’re thrilled to get this newest version of Capacitor into your hands and can’t wait for you all to update your apps. Cheers!


Conner Simmons

Product Team