.NET 5 Swift Interoperability

Never say never :upside_down_face: We‘ll see when Unity will also move further towards .NET 5, especially because of the platform support they don‘t have to deal on their own anymore.

I don‘t expect it to happen any time soon, and I‘m patient enough to wait as long as I have to. :)

Yes. That should be doable. There is a stub generator for this already. GitHub - mono/Embeddinator-4000: Tools to turn .NET libraries into native libraries that can be consumed on Android, iOS, Mac, Linux and other platforms.

Unity is heavily invested in a game optimized version of .net. That won’t change. They do use the Microsoft Rosetta compiler to generate their intermediate representation. The runtime and low level compilers are custom. Mono is used for debug builds.

Any realistic Swift interop will probably be for UWP/ Xamarin / or .net core.

I do not question your knowledge and believe you. It's just a wish-thinking of mine that one good day I will be able to script a few tiny games in Swift and have a great engine like Unity under the hood.

Having an official Swift interop in C# is the first right step. :slight_smile:

I don’t really understand why, but game engines are normally built like platforms instead of libraries. That makes them weird to integrate with. Godot is probably the easiest popular engine to build bindings for, but it also takes the platform approach.

I’m really interested to see how realitykit has advanced since last year. There is evidence of a visual shading language under the hood in Catalina. There is a chance it might not be missing any tent pole features this year.

1 Like

In theory, if WinUI had C bindings, would it be usable from Swift? C libraries are usable on macOS and Linux, but WinUI is (for the most part) C++.

Yes, if WinUI had C bindings, it would be usable from Swift. That is what Swift/Win32 uses to provide access to the Windows Win32 interfaces.

C bindings can be created (by hand) for C++ libraries, right? If I could get this working, I'd be so excited. Windows GUI/desktop application development with Swift using Fluent is the dream. I might have a fun project ahead of me :slight_smile:

This is for Xamarin, they want to do something like Kotlin MPP, and consume swift libraries

In my opinion it is wasted effort

They should embrace fully Swift, it already work on both iOS / Android, they should join to augment forces to port it on their platform

Microsoft is lost..

1 Like

You might not consider that a very reasonable suggestion, but mockery as a response is definitely a code of conduct violation.

3 Likes

FWIW, I did not intend my reply as mockery, but merely to say that she chance of Microsoft abandoning their own (actually quite good) language tool chain for a solution "not invented here" is about the same as that of a snowball in hell on a very warm day...