Two HTML files to iOS

I’m wondering if anyone ever exported two different HTML files to iOS and make a connection between them? Is this even possible?

Not had them talk to each other but it shouldn’t be too hard.

My thoughts are to use the swift handlers for post messages to act as an intermediary between them.
Should be pretty simple.

Html <-> swift <-> html

I’ll try to find some info that can help me. Thank you.

I'd be curious to hear more details on what you're trying to do? Things like:

  • Will there be a native app that can communicate? Will they be in two separate web views?
  • Will they be in the same web view and shown at the same time?
  • Or will they be in the same web view and shown at different times?
  • What is the purpose of the connection and what data needs to be shared?

UPDATED: This does work I had a typo in the swift which took me a while to spot so initially reported here that it does not work as expected.

It does work as expected , so please ignore the comments below regarding not working.
This post is now edited to reflect that.

I've been playing with this ( for a bit, ALL DAY) Doing my head in..

I have set up two WKWebviews, UIViewRepresentable ( swiftUI )



Given each a coordinator

All Class names in each UIViewRepresentable are slightly changed, to avoid any obvious clashes.

There are Two Hype Docs



When the Hype DocOne posts a message intended for DocTwo,


it's web view WebViewOne will capture the message and forward it to WebViewTwo by calling a function sendMessageToTwo(message: String) in the coordinator's class of WebViewTwo

The function will post the message to DocTwo.

i.e ;

let script = "HYPE.documents['DocTwo'].functions(HYPE.documents['DocTwo'], 'element' ,'event').messageFromOne(HYPE.documents['DocTwo'], '\(message)', 'event')"

When the Hype DocTwo posts a message intended for DocOne,


it's web view WebViewTwo will capture the message and forward it to WebViewOne by calling a function sendMessageToOne(message: String) in the coordinator's class of WebViewOne

The function will post the message to DocOne.

i.e ;

let script = "HYPE.documents['DocOne'].functions(HYPE.documents['DocOne'], 'element' ,'event').messageFromTwo(HYPE.documents['DocOne'], '\(message)', 'event')"

Also note: when you post from the App to you hype dic as we are doing above you can get feed back from the app without re postMessaging .

For example the hype . functions() I target in the hype docs can have

return “got your message”

At the end.

1 Like

I’d like to have 2 or more different exports in one app where one can click a button (or swipe) to switch between the exports. I could do this inHype, but the file will be too large to work with I guess.

Wow, that’s a lot of work. A shame it doesn’t seem to be possible. Thanks for your efforts.

1 Like

Hmm, why do you need communication between the apps?

I do see the that Comms between them in a iOS App would be something of possible use.
I do have apps with multiple WKWebviews and talk to at least one of them from iOS to Hype and back

and I am probably lucky I have not run into this issue before.
It is an odd one since one project can talk to both iOS and the other project but the other one can only talk to iOS and not the other Hype project.
Hoping @jonathan has some clues.

For the Love of...
Ok clearly I was seeing the wood for the trees when figuring this out.

I just came back to it and noticed my mistake.

I had DocTwo trying to post directly to DocOne because I copied and pasted some of my code and did not changes a name to reflect DocOne.

Any way it does work. Will update the above.. also

1 Like