Starting with version 6.5, Unity supports generating Swift Xcode projects for iOS and tvOS using a SwiftUI-based template. This project type modernizes Unity’s Apple platform integration while preserving Unity’s runtime, IL2CPP pipeline, and native plug-in ecosystem.
For more information, refer to Swift (Apple Developer).
A Swift project in Unity is an Xcode project with the following features:
UnityFramework.framework, is linked into the main Swift binary.MainApp/MainApp.swift.The features of the Unity Player work the same as they do in the Objective-C project type, with some known exceptions. Project types are interchangeable, so you can choose the one that suits your needs.
Using a Swift project provides the following advantages from both Apple’s ecosystem and Unity’s integration perspectives.
Swift is Apple’s primary modern language, offering:
While the Unity runtime is primarily C++ (UnityRuntime.framework), the platform adoption layer is written in Swift. This enables:
Consider the following use cases of migrating to a Swift project type in Unity:
To migrate an existing project from Objective-C to Swift, refer to Migrate to a Swift Xcode project type.
When you develop native plug-ins for Unity on Apple platforms, your plug-in might need to work across a wide compatibility matrix. Design your plug-ins for this matrix, not for a single target. For more information, refer to Introduction to native plug-ins on iOS.