OpenSwiftUI icon indicating copy to clipboard operation
OpenSwiftUI copied to clipboard

How do OpenSwiftUI and SwiftUIEmbedded work?

Open ngocdaothanh opened this issue 6 years ago • 5 comments
trafficstars

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.

ngocdaothanh avatar Nov 06 '19 22:11 ngocdaothanh

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:

  • SVG
  • Desktop PostScript
  • Cairo (https://www.cairographics.org)
  • Cairo for Swift (https://github.com/PureSwift/Cairo)
  • Opal (https://github.com/gnustep/libs-opal)
  • Doggie (https://github.com/SusanDoggie/Doggie)
  • Skia (https://skia.org)
  • LittlevGL (https://littlevgl.com) …

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!

Cosmo avatar Nov 08 '19 07:11 Cosmo

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

lin7sh avatar Nov 20 '19 11:11 lin7sh

@ngocdaothanh are you still working on SkiaSwift?

Cosmo avatar Dec 12 '19 06:12 Cosmo

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.

ngocdaothanh avatar Dec 13 '19 00:12 ngocdaothanh

Oh, that's really cool!

Cosmo avatar Dec 13 '19 04:12 Cosmo