Swift with Unreal Engine, using Swift programming language for UE5/Game Development

Hello all!

I have been focusing my efforts lately on bringing many of the widely adopted computer graphics libraries to the Swift programming language, all made possible with Swift 5.9’s C/C++ Interop Feature, which allows a great variety of C++ APIs to be called directly from Swift, and select Swift APIs can be used from C++, along with the ability to remove CMake entirely, vastly reducing the development overhead of maintaining often hundreds of thousands of lines of CMake code in existing C/C++ projects by authoring a single Swift Package Manager (SPM) manifest file, called Package.swift, which defines the package’s name, its source code, and resource contents and is created at the root (top level directory) of the Swift, and/or C/C++ project repository.

So far, by using this approach I have been able to successfully build 30 foundational C/C++ computer graphics libraries within a single monolithic swift package which encapsulates much of the Academy Software Foundation (ASWF) Software Landscape, allowing the C/C++ APIs of all these libraries to be called directly from Swift, in addition to also allowing this swift package to be used as a single package dependency to build other Swift, C, and C++ projects. See MetaverseKit to learn more and use it in your existing project.

In addition to MetaverseKit, I have been able to bring Pixar’s Universal Scene Description (USD), a widely adopted (C++ and Python) computer graphics library, to use directly in Swift as well, with SwiftUSD.

Which leads me to the conclusionary topic of discussion:

Is there any developer interest in using the Swift programming language for video game development, and the potential for writing Swift code either as a replacement for or in addition to existing Unreal Engine games written in C/C++?

In addition to building games in Swift with Unreal Engine, I could additionally get the Unreal Engine application itself to build and run cross-platform (Linux, Microsoft Windows, macOS) through a single terminal command:

$ swift run UnrealEngine

I am curious to all of your thoughts in an open discussion, thanks!

4 Likes

Hello!

Basically I am a iOS/Swift Developer with Unity/C# experience and I would love to try Unreal Engine but the thing with C++ is holding me back. I’ve worked with C++ already in the past but in comparison with any modern language, C++ is really old and unfriendly. If there would be any possibility to enable Swift in Unreal Engine, that would be a game changer for me.

1 Like

That would be cool. Even cooler would be if Unreal Engine could integrate directly into SwiftUI, so there could be a ‘view’ that UE renders into, but interops with the rest of SwiftUI.

1 Like

I’m very interest in this!

But looking at the GitHub site, there are not any examples on how to use this much less where this stands (alpha, beta, release?). I’m loathe to spend time on something that may end up as abandonware.

I’m also very concerned that this appears to be a one-person project and that changes in UE may require waiting for updates in the MetaverseKit. While this may be fine for one-person shops, it introduces an element of risk.

Lastly, how does this work for moving games to PS5 or Xbox? I see that iOS is supported, but that can be seriously limiting.

I for one would be very interested in this capability and if I can carve out the time, would want to contribute to its success. If you haven’t already, I would reference or even try and get into contact with Miguel de Icaza who has been active in bringing Swift to other game engines, Godot for example.

1 Like

I would love to be able to use swift instead of c++ for unreal

Hey I’m not sure if I am understanding this correctly, but being able to call swift code/apple api’s from inside UE would be fantastic, IE: calling ImageTrackingProvider on the Vision Pro would be a big step for us in a project

1 Like

Hello! I’m in the process of learning unreal and swift and would love to see a way to bring swift into unreal. Could there be a way to connect/make nodes with it too so that I could right things with blueprints but still connect those to swift for accessing Apple features like health? I come from a design background and visual scriptong is already used in many design programs. It’s a great way to bridge visual learners with programing logic. Anyway, someway to connect swift and blueprints would be amazing!

I am interested and looking forward to good news :muscle:

I am looking at building a game in Swift. Having one language to focus on would certainly help with finding issues/bugs quickly. If/when you get this going, update here and when I have time, I would love to assist with development.