Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Introduction to the Swift Xcode project type for iOS and tvOS

Overview of the Swift Xcode project type for iOS and tvOS.
Read time 2 minutesLast updated a month ago

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).

Features of a Swift project type

A Swift project in Unity is an Xcode project with the following features:
  • The application entry point and app lifecycle are implemented in Swift through a SwiftUI-based template.
  • The Unity Player,
    UnityFramework.framework
    , is linked into the main Swift binary.
  • The main app initialization starts from
    MainApp/MainApp.swift
    .
  • You can write native plug-ins in Swift, Objective-C, Objective-C++, C, or C++.
  • Provides a public API for native plug-in developers.
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.

Benefits of using a Swift project type

Using a Swift project provides the following advantages from both Apple's ecosystem and Unity's integration perspectives.

Apple’s ecosystem benefits

Swift is Apple’s primary modern language, offering:
  • Better memory safety and fewer runtime crashes.
  • Improved performance and compile-time checks.
  • SwiftUI support.
  • Integration with modern Apple SDKs.

Unity development benefits

While the Unity runtime is primarily C++ (
UnityRuntime.framework
), the platform adoption layer is written in Swift. This enables:
  • A modernized iOS or tvOS Xcode project template.
  • A cleaner, Swift-first approach and Swift-native plug-in workflows.
  • Improved alignment with Apple platform standards.
  • A future-proof development architecture.
  • A dedicated Unity public API for plug-ins.
Consider the following use cases of migrating to a Swift project type in Unity:
  • Use a Swift project type for new iOS and tvOS Unity projects.
  • You have existing projects that integrate Swift-based SDKs.
  • Teams that are standardizing on Swift for Apple development.

Migrate an Objective-C project to Swift

To migrate an existing project from Objective-C to Swift, refer to Migrate to a Swift Xcode project type.

Guidance for native plug-in developers

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.

Additional resources