TokamakUI / Tokamak

SwiftUI-compatible framework for building browser apps with WebAssembly and native apps for other platforms
Apache License 2.0
2.62k stars 111 forks source link

UI/NSViewControllerRepresentable and UI/NSViewRepresentable? #465

Closed OmerFlame closed 2 years ago

OmerFlame commented 2 years ago

Will there ever be any support for them? I saw something about AppKit support in one of the commits and pull requests, can anyone elaborate on that?

MaxDesiatov commented 2 years ago

Tokamak currently doesn't target any of the Apple platforms for GUI apps. While you can build it for macOS for generating static HTML with the HTML renderer, I don't think there's much sense in using Tokamak for GUI on those platforms, you should use SwiftUI directly instead. Does that answer your question?

OmerFlame commented 2 years ago

Not exactly, I want to write UI just like in Tokamak but also bridge UIKit or AppKit with it, simply because I like UIKit/AppKit more than SwiftUI (Tokamak is close enough to SwiftUI in its syntax so I can call it that).

MaxDesiatov commented 2 years ago

I'm still not sure I fully understand your use case. Could you clarify what exact platforms you are targeting?

OmerFlame commented 2 years ago

I want to target my project for the web, but I to use things that are compatible with UIKit (through UIViewControllerRepresentable in order to make an element that it compatible with SwiftUI, which you are supporting according to you).

MaxDesiatov commented 2 years ago

UIKit and AppKit are only available on Apple's platforms. If you have any code that depends on UIKit, you'll have to rewrite it for it to work in the browser. Because of this, UIViewRepresentable and NSViewRepresentable are of no use in Tokamak, since neither UIView nor NSView are available on non-Apple platforms, including WebAssembly.

We wouldn't even be able to express UIViewRepresentable in Tokamak source code, because there's no UIView implementation available for us.