Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi 👋
Background
We have several mobile apps that are built using turbo-ios.
In all of them we extensively use a custom
NativeBridge
class that at its core evaluates JS in the WebView to communicate with the JS side.Very stripped down, it looks like this:
Nowadays we would use BridgeComponents for the JS communication.
I see a lot advantages in BridgeComponents and see myself migrating a lot of the communication over to it.
Problem
We use the
NativeBridge
class in a lot of places in our codebase. Often its used without any visual counterpart.Examples:
It would be possible to use non-visual BridgeComponents for these cases. But it would introduce quite a bit of overhead and a lot of work to migrate and still maintain the older app versions.
Even though I see myself migrating a lot of the communication to BridgeComponents, I would like to keep the
NativeBridge
class around for some non-visual communication.Idea
This PR would expose the currently active WebView.
This would allow apps that used a selfmade NativeBridge to still post messages to the currently active WebView.
And it would allow us to migrate our apps to Hotwire Native and get the joy of all the newly added features without having major rewrites.
I've already talked with @joemasilotti about this. It would be great to hear some feedback from the rest of the team and if this is something that you could see being exposed.