Skip to content

Add Swift project type support - #108

Open
mindaugasv-unity wants to merge 2 commits into
apple:mainfrom
mindaugasv-unity:feature/add-swift-project-type-support
Open

Add Swift project type support#108
mindaugasv-unity wants to merge 2 commits into
apple:mainfrom
mindaugasv-unity:feature/add-swift-project-type-support

Conversation

@mindaugasv-unity

Copy link
Copy Markdown

Problem

Unity has introduced a Swift project type for iOS, tvOS, and iPadOS in Unity 6.5 and later, and the current Apple plugins don't work with it.

Fix

I'm adding updates to the Core and PHASE plugins so they work correctly with the Swift project type.

  • In Core, updated how the project path is fetched, because the project name is now dynamic and based on the Unity project name. It now uses GetPBXProjectPath(), which was updated to return the correct path when using the Swift project type.
  • In PHASE, updated the Xcode project path fetching and how the plugin is loaded. For now, it has to use the +load function to subscribe to the unityDidInitializeRuntime notification, which is when low-level plugins need to be initialized. In the future, we're designing a better hook for plugins to do similar operations before Unity loads.

Left for future work:

  • The current plugins don't work correctly with Unity 6.5 and above, due to the missing migration from instanceID to entityID in the C# code.
  • The Accessibility plugin needs an update as well, though it isn't as straightforward, since the UnityView class isn't part of the public API and is accessed differently.

Notes

Swift project type is a new implementation of the exported Xcode project and the native layer that connects to the Unity engine. We've written a migration guide for it and explicitly defined the public API that plugins can use.

@ryzngard

ryzngard commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this contribution. I'll catch up on the swift announcement soon. I wanted to comment that we did have a community fix for deprecated APIs in #104

@mindaugasv-unity

Copy link
Copy Markdown
Author

I wanted to comment that we did have a community fix for deprecated APIs in #104

Thanks. To clarify, we have no plans to work on items listed in "Left for future work", just highlighting what still needs to be addressed.

Also, I've missed a bug in PHASE plugin, in older Unity versions both .mm files would added to Xcode project. Will update with a fix on Monday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants