BT

InfoQ Homepage News Ionic Capacitor: Creating Native Applications with JavaScript

Ionic Capacitor: Creating Native Applications with JavaScript

Leia em português

Bookmarks

Capacitor is a new development framework by Ionic for hybrid application creation. Capacitor provides an alternative to Apache Cordova, a well-established solution first released in 2009.

Ionic's decision to create an alternative to Cordova is due to two main factors: Cordova's outdated plugin system, and its restrictive approach to managing native platforms.

Cordova and Capacitor provide a plugin system that enables the communication between JavaScript and native platform capabilities, such as Bluetooth and RFID. In recent years, the Cordova plugin system has struggled to keep up with new technologies.

A good example would be the Swift language, released by Apple at the end of 2014 but added to the Cordova plugin system in 2019 (Swift was supported earlier by a third-party plugin).

An outdated plugin system can harm the entire ecosystem, mainly when the ecosystem relies heavily on third-party plugins.

The Capacitor plugin system provides a more straightforward development process that supports up-to-date technologies.

Since the Capacitor plugin ecosystem is still relatively small, developers can continue using the vast majority of Cordova plugins within Capacitor. This compatibility is a temporary solution to ensure developers do not lose access to essential platform capabilities.

Native project management is the second change Capacitor brings to the industry. Cordova generates native platform code at build time. Developers use a shared configuration file that includes instructions to build the application, which then gets used by Cordova during the native build process. This approach simplifies the build process at the cost of limited access to native projects.

While the solution provided by Cordova is easy to use and works well for small projects, it presents a challenge for larger, more complicated projects, which often require greater control over the native project code and configuration.

To solve this, Ionic Capacitor takes a less intrusive but more flexible approach. Capacitor generates and syncs the JavaScript code for the native platforms, but requires developers to manage the native platform code themselves directly. This native code management requires additional effort from developers, but provides greater control over the native aspects of their projects.

Both Cordova and Capacitor extend their reach beyond mobile applications, and now support the creation of PWA and desktop applications (with Electron), though the support of these capabilities is not as complete as their hybrid mobile application support.

Ionic Capacitor is open source software available under the  MIT license. Contributions are welcome via the Capacitor contribution guildines and contributors should follow the Capacitor code of conduct.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • IONIC Capacitor - great tool

    by Anil Kurmi /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    This tool is really awesome as Cordova has many outdated plugins and Mobile Phones are coming with tons of features every year. Community should support this project by any means.

    Great Info thanks for sharing.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.