Is it possible to integrate Capacitor into an existing iOS/Android App?

I’m consider migrating certain native views/component in my App to PWA. I’m looking for a good native engine to run PWAs that will allow creating plugins, etc…
I stumbled upon capacitor and it seems to be just what I wanted. But all the Getting Started, etc… mention starting with a web App.

Is there a guide to integrate some of Capacitor features into an existing App to gradually migrate native views into PWAs?

Thanks!

Capacitor, like Cordova and PhoneGap before it, is fundamentally a message bridge with a browser/JavaScript environment on one side and a twisty maze of native plugins on the other. All the user interaction is typically done on the browser side, because that sort of thing is what browsers are good at.

So if your UI is not using a webview, then it doesn’t really fit neatly into the slot Capacitor is designed to fill.

The task of (re)writing your interaction screens as web pages using a JavaScript app framework like Angular, React, or Vue would need to be done by you first, and then Capacitor can help you “reach back” to the native world for functionality that can’t be achieved directly from the browser (something like Bluetooth communication, for example).

@rapropos Thanks for the reply. Apologies as I should have explained myself better in the question, but I fully understand what Capacitor/Cordova is.

My use case is that I have an existing App but I also have an existing mobile Web Application. I want to test the impact of removing certain native views with WebViews, living in an hybrid situation where I can present wither a native view or a Capacitor Webview depending on runtime configuration.

I tried to find a resource of “How to integrate Capacitor into an existing iOS/Android App” but I only found “How to transform an existing PWA into an App with Capacitor”.

What I need is some CocoaPod/Gradle Lib I can integrate with and instructions on any setup I need to do in an existing App to present a Capacitor powered WebView.

I think what you’re describing is what the Ionic team has called “embedded Capacitor” in the past. This was originally on the roadmap for Capacitor 3, but has been postponed. See e.g. Embedded Capacitor · Issue #3182 · ionic-team/capacitor · GitHub, and also this community effort: GitHub - fkirc/embedded-capacitor: Embedding of https://capacitorjs.com/ into existing native apps

Ionic will probably soon offer an Enterprise solution for this under the name “Ionic Portals”, see Portals: a Supercharged Web View - Ionic - The Cross-Platform App Development Leader.

2 Likes