Cosmo / OpenSwiftUI

WIP — OpenSwiftUI is an OpenSource implementation of Apple's SwiftUI DSL.
MIT License
1.38k stars 65 forks source link

How do OpenSwiftUI and SwiftUIEmbedded work? #1

Open ngocdaothanh opened 4 years ago

ngocdaothanh commented 4 years ago

Hi,

How do OpenSwiftUI and SwiftUIEmbedded work and how they are structured?

It seems that you are creating a renderer: https://github.com/Cosmo/Pixels

I'm creating this renderer: https://github.com/swiftfn/SkiaSwift

Demo: https://github.com/swiftfn/SkiaSwift/blob/master/Sources/Demo/main.swift

It's about 50% finished, I'm aiming to finish it soon.

I think it's very useful for your OpenSwiftUI project, so that you can focus on porting SwiftUI, instead of having to create your own renderer.

Cosmo commented 4 years ago

Hey @ngocdaothanh, thanks for reaching out!

OpenSwiftUI provides the infrastructure and SwiftUI DSL without any platform-specific code. That means the actual rendering of a UI + Interaction and platform-specific elements is supposed to come from another project (like SwiftUIEmbedded for example). This kind of separation will pave out the way for many different implementations of (Open)SwiftUI on various platforms without dictating how things should look and feel like.

I created SwiftUIEmbedded to show an extreme example of running SwiftUI outside of iOS, tvOS, watchOS or macOS on simple hardware. This project depends on OpenSwiftUI and extends it with the actual rendering.

For 2D graphics I had these technologies / libraries in mind:

I was quite overwhelmed with the many possibilities and also didn't want to bother to think about compiling C or other languages, writing bridges, testing etc. So I created Pixels to keep things simple for now without having any external dependencies. What I know, is that Pixels was great to have at least something, but keeping it as part of the project makes no sense for the future.

In the following days I'll work on some code clean up tasks, updating the README and make the project more friendly towards potential contributors.

Any suggestions or pull requests are welcome of course!

lin7sh commented 4 years ago

Also pointing out to a cross-platform rendering API bgfx, it supports all popular backend including(metal, vulkan, directx12) and another cross-platform swift UI framework already plan to moving its rendering backend to it

Cosmo commented 4 years ago

@ngocdaothanh are you still working on SkiaSwift?

ngocdaothanh commented 4 years ago

I'm pausing SkiaSwift to work on a tool to automatically create Swift binding for Skia: https://github.com/swiftfn/Cpp4Susans

SkiaSwift is manual work, so every time Skia changes, SkiaSwift needs to be manually updated.

Cosmo commented 4 years ago

Oh, that's really cool!