Skip to content

Commit

Permalink
Workaround to link Swift Standard Libraries
Browse files Browse the repository at this point in the history
The Xcode project generate from Unity may not be able to link Swift
Standard Libaries properly if
1. Some pods include Swift frameworks
2. Podfile sets to link frameworks statically

The workround attempts to fix this by
1. Add a Dummy.swift file to the Xcode project.
2. Enable `CLANG_ENABLE_MODULES` and `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES`
   build settings.
3. Change `SWIFT_VERSION` to the value specified in iOS Resolver
   settings. Default to "5".

This workaround is turned OFF by default.
  • Loading branch information
chkuang-g committed Apr 6, 2022
1 parent 56aaa44 commit 04dc47c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions source/IOSResolver/src/IOSResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ public static bool PodfileStaticLinkFrameworks {
}

/// <summary>
/// Ehether to enable Swift Framework support workaround.
/// Whether to enable Swift Framework support workaround.
/// If enabled, iOS Resolver adds a Dummy.swift to the generated Xcode project, and change build
// properties in order to properly include Swift Standard Libraries.
/// </summary>
Expand Down Expand Up @@ -2030,7 +2030,6 @@ internal static void AddDummySwiftFile(
public static void OnPostProcessGenPodfile(BuildTarget buildTarget,
string pathToBuiltProject) {
if (!InjectDependencies() || !PodfileGenerationEnabled) return;
Log("OnPostProcessGenPodfile!", level: LogLevel.Error);
GenPodfile(buildTarget, pathToBuiltProject);
}

Expand Down
4 changes: 2 additions & 2 deletions source/IOSResolver/src/IOSResolverSettingsDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ public void OnGUI() {
settings.swiftLanguageVersion =
EditorGUILayout.TextField(settings.swiftLanguageVersion);
GUILayout.EndHorizontal();
GUILayout.Label("Used to set 'SWIFT_VERSION' build setting in Xcode. Leave " +
"it blank to update it manually.");
GUILayout.Label("Used to override 'SWIFT_VERSION' build setting in Xcode. " +
"Leave it blank to prevent override.");
}
}

Expand Down

0 comments on commit 04dc47c

Please sign in to comment.