Using Windows Runtime from Swift

I thought that people here might care about this little demo:
compnerd/SwiftWinRT: WinRT Bridging for Swift (github.com)

It shows how we could possibly bridge the Windows Runtime into Swift. Having a quick peek at the generated assembly shows that in release mode, it should be largely what we want:

if (this)
  if (SUCCEEDED(<virtual dispatch>))
    return;
return Error;

With this work, the entire modern Windows aspects (UWP, WinUI, WinRT, Xaml) can now be exposed to Swift, and done so largely with performance close to C++. There definitely is a fair amount of work left here, but there is now some light on the path that will provide the foundations for access to the full Windows API surface, with the ability to immediately gain access to future APIs as well.

Saleem

There is some additional follow up work that I intend to put up soon that will show how this actually provides truly first class Windows development

44 Likes

Cool!

It can't be understated how important this is to continue to expand swift's adoption as a general purpose language. Thank you so much for your efforts :pray:

6 Likes

Awesome, that’s great news!

I’d love to see a Swift DSL for WinUI. This is getting really exciting!

2 Likes
Terms of Service

Privacy Policy

Cookie Policy