Overview of Capacitor

An introduced to Capacitor, Ionic’s cross-platform runtime that allows web apps to be run across iOS, Android, and the web.

Introduction to Capacitor

The goal of Capacitor is to provide a consistent set of APIs that adhere as closely to web standards as possible whilst also being able to access native device features on platforms where such features are supported. it is important to be aware of this final point, as there may be certain contexts where features simply aren’t supported on certain platforms. As such, alternative fallbacks may be required.

Although it is seen as a “spiritual” successor to Awesome Cordova Plugins, Capacitor is also backward-compatible with many Apache Cordova plugins. This is useful for those projects where we may need to use both Capacitor and Awesome Cordova Plugins.

Be aware that Capacitor is relatively new compared to Apache Cordova and as a result has a far more limited ecosystem in comparison. This means that we will also have a much more reduced selection of available plugins. This will change as more developers begin contributing to the Capacitor project, but for now, our only options are to roll our own plugin or draw from the Awesome Cordova Plugins repository.

System requirements

To use Capacitor, your system environment must be running, at a minimum, Node v12.0+ and NPM v6.9.0+. Capacitor also fully supports Yarn for those using that package dependency manager.

iOS development

For iOS development, the following requirements exist:

  • Mac with Xcode 11 or above.
  • Xcode Command Line tools (from Xcode or via command line with the following command: xcode-select install).
  • CocoaPods installed (via the command line with the following: sudo gem install cocoapods. We will also need to have Ruby installed on our system).

Capacitor uses the WKWebView and as a general rule always supports at least, the last two versions of iOS.

Note: If you are developing on a Windows platform, you can still build for iOS using Ionic Appflow.

Android development

For Android development, we need:

  • Android SDK with Android Studio (the Android CLI tools themselves would be sufficient, but Android Studio does make the process of building and running your application easier to accomplish).

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy