BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Ionic Announces Capacitor 1.0.0 Alpha for Creating Web, Hybrid, and Native Apps

Ionic Announces Capacitor 1.0.0 Alpha for Creating Web, Hybrid, and Native Apps

This item in japanese

The Ionic team has announced the first alpha release of Capacitor, a new approach for building web, hybrid, and native apps on mobile and desktop platforms with JavaScript.

Capacitor seeks a position between traditional hybrid platforms like Cordova and native compilation platforms like React Native and NativeScript, while also offering full support for Progressive Web Apps (PWA). For installed mobile applications, the Capacitor project promises developer flexibility for determining which portions of an application get delivered as native code vs. features offered in a web view or as a PWA.

The project draws significant inspiration from Cordova, but has several distinctions from this framework:

  • A JavaScript runtime to include within Capacitor apps, providing a cross-platform API translation layer for native and Web API calls
  • Swift-based code on iOS platforms
  • Progressive Web Apps for web apps
  • Electron for hybrid desktop apps in a future release

The Ionic team explains in their alpha announcement that Ionic users had:

[...] problems beyond just the core Ionic Framework UI components they are using. These teams expect that we can help them with other mobile challenges, and highest on their list is almost universally better native support and plugins.

These requirements motivated the Ionic team to start a new project rather than attempting to make significant changes to Cordova. Capacitor strives to maintain compatibility with Cordova for plugins to facilitate the use of Cordova plugins within Capacitor applications. Ionic CEO Max Lynch explained to the InfoQ team that:

Cordova has had a solid vision since day 1 to shim web APIs for native apps, but sometimes this doesn't go far enough for creating real world app use cases. Today there are some things that are easier to build natively. Also Cordova doesn't really support building Progressive Web Apps."

As a result, Capacitor provides flexibility in targeting common development experiences and patterns for apps created with web technologies and deployed with a mixture of native and web code. For example, Capacitor strives to provide a simple experience for creating applications with camera access that is consistent with both native and web technologies.

To add Capacitor to existing modern JavaScript web apps, run the following commands:

cd my-app
npm install --save @capacitor/core @capacitor/cli

Once installed, Capacitor is initialized with application information:

npx cap init [appName] [appId]

Within the previous command, appName is the name of the application, and appId is the domain-style app identifier for an app (e,g, com.example.app). Additional information is available at the Capacitor getting started guide.

Developers using Ionic should expect integration with Capacitor to be complete with the Capacitor beta release. The Ionic team anticipates a stable release of Capacitor by mid-2018. Capacitor is open source software under the MIT license, and contributions are welcome via the Capacitor GitHub project.

Rate this Article

Adoption
Style

BT