Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded Capacitor #3182

Closed
imhoffd opened this issue Jun 30, 2020 · 9 comments
Closed

Embedded Capacitor #3182

imhoffd opened this issue Jun 30, 2020 · 9 comments

Comments

@imhoffd
Copy link
Contributor

imhoffd commented Jun 30, 2020

Allow for the use case of embedding Capacitor inside native apps.
Allow for multiple instances of Capacitor in an app (not necessarily concurrently).

@fkirc
Copy link
Contributor

fkirc commented Jul 20, 2020

I think that "Embedded Capacitor" already works today, but there are still some minor glitches like #3280.
Nevertheless, it would be nice to have some additional documentation and tested sample code for embedded usage.

My goal remains to bring Capacitor into existing native codebases as smooth as possible (with as little immediate changes as possible). Once this initial Capacitor-ramp-up is successful, it becomes easier to re-write large apps in a gradual manner.

@imhoffd
Copy link
Contributor Author

imhoffd commented Jul 20, 2020

@fkirc Great to hear. Please follow Capacitor 3 development! We will be doing dev releases once development picks up a bit. Your feedback would be very valuable.

@JovanShandro
Copy link

Is there any plan to add more documentation into how to do this embedding? We are currently looking for possible ways to embed parts of a Capacitor app on a native application. I saw in #3280 that a class called BridgeFragment exists, but could not manage to find any example of how to use it, and also didn't manage to find a way of how to achieve this on Ios. Is this still a feature that is under development, or is it just lacking documentation?

@fkirc
Copy link
Contributor

fkirc commented Aug 26, 2020

BridgeFragment is already working and you can embed it into a native Android app like any other fragment (e.g. inflate it from an XML layout).

However, there are still some rough edges because this is not yet an official feature.
For example, BridgeFragment seems to have a bug that makes capacitor.config.json partially broken. This bug can be easily fixed with a one-line change, but my point is that you should not trust the current BridgeFragment implementation.
If you demand a highly customized configuration, then you might need to write your own BridgeFragment (which is doable because the relevant code is short and easy to read).

@fkirc
Copy link
Contributor

fkirc commented Aug 26, 2020

For iOS: I managed to embed Capacitor into an existing native iOS app by embedding CAPBridgeViewController.swift.
In my case, I embedded CAPBridgeViewController into an existing Storyboard via raw XML-editing in Xcode, but I am pretty sure that there are also other ways to do it.
In principle, everything should work out of the box once you spin up a CAPBridgeViewController.

@carlpoole
Copy link
Member

Allow embedded capacitor to load a specific path on an instance of embedded capacitor as described here: #3405.

@imhoffd
Copy link
Contributor Author

imhoffd commented Dec 8, 2020

For those following this issue, I removed the 3.0.0 milestone because it may be confusing. We are laying the foundation for "Embedded Capacitor" with the 3.0.0 release, but there will still be much work to do. Thanks for your patience!

@jthoms1
Copy link
Contributor

jthoms1 commented Mar 3, 2021

Closing this enhancement request.

@jthoms1 jthoms1 closed this as completed Mar 3, 2021
@ionitron-bot
Copy link

ionitron-bot bot commented Nov 11, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants