diff --git a/source/IOSResolver/src/IOSResolver.cs b/source/IOSResolver/src/IOSResolver.cs index ab6c2cf1..224baa3d 100644 --- a/source/IOSResolver/src/IOSResolver.cs +++ b/source/IOSResolver/src/IOSResolver.cs @@ -493,6 +493,9 @@ protected override bool Read(string filename, Logger logger) { // Whether to add "use_frameworks!" in the Podfile. private const string PREFERENCE_PODFILE_ADD_USE_FRAMEWORKS = PREFERENCE_NAMESPACE + "PodfileAddUseFrameworks"; + // Whether to add "use_modular_headers!" in the Podfile. + private const string PREFERENCE_PODFILE_ADD_USE_MODULAR_HEADERS = + PREFERENCE_NAMESPACE + "PodfileAddUseModularHeaders"; // Whether to statically link framework in the Podfile. private const string PREFERENCE_PODFILE_STATIC_LINK_FRAMEWORKS = PREFERENCE_NAMESPACE + "PodfileStaticLinkFrameworks"; @@ -521,6 +524,7 @@ protected override bool Read(string filename, Logger logger) { PREFERENCE_WARN_UPGRADE_WORKSPACE, PREFERENCE_SKIP_POD_INSTALL_WHEN_USING_WORKSPACE_INTEGRATION, PREFERENCE_PODFILE_ADD_USE_FRAMEWORKS, + PREFERENCE_PODFILE_ADD_USE_MODULAR_HEADERS, PREFERENCE_PODFILE_STATIC_LINK_FRAMEWORKS, PREFERENCE_SWIFT_FRAMEWORK_SUPPORT_WORKAROUND, PREFERENCE_SWIFT_LANGUAGE_VERSION, @@ -1066,6 +1070,20 @@ public static bool PodfileAddUseFrameworks { settings.SetBool(PREFERENCE_PODFILE_ADD_USE_FRAMEWORKS, value); } } + + /// + /// Whether to add "use_modular_headers!" in the Podfile. False by default. + /// If true, iOS Resolver adds the following line to Podfile. + /// + /// use_modular_headers! + /// + public static bool PodfileAddUseModularHeaders { + get { return settings.GetBool(PREFERENCE_PODFILE_ADD_USE_MODULAR_HEADERS, + defaultValue: false); } + set { + settings.SetBool(PREFERENCE_PODFILE_ADD_USE_MODULAR_HEADERS, value); + } + } /// /// Whether to statically link framework in the Podfile. False by default. @@ -2349,6 +2367,10 @@ public static void GenPodfile(BuildTarget buildTarget, "use_frameworks! :linkage => :static" : "use_frameworks!"); } + + if (PodfileAddUseModularHeaders) { + file.WriteLine("use_modular_headers!"); + } } int versionCount = 0; diff --git a/source/IOSResolver/src/IOSResolverSettingsDialog.cs b/source/IOSResolver/src/IOSResolverSettingsDialog.cs index e8f7001d..1a4d1fae 100644 --- a/source/IOSResolver/src/IOSResolverSettingsDialog.cs +++ b/source/IOSResolver/src/IOSResolverSettingsDialog.cs @@ -38,6 +38,7 @@ private class Settings { internal bool verboseLoggingEnabled; internal int cocoapodsIntegrationMenuIndex; internal bool podfileAddUseFrameworks; + internal bool podfileAddUseModularHeaders; internal bool podfileStaticLinkFrameworks; internal bool swiftFrameworkSupportWorkaroundEnabled; internal string swiftLanguageVersion; @@ -58,6 +59,7 @@ internal Settings() { cocoapodsIntegrationMenuIndex = FindIndexFromCocoapodsIntegrationMethod( IOSResolver.CocoapodsIntegrationMethodPref); podfileAddUseFrameworks = IOSResolver.PodfileAddUseFrameworks; + podfileAddUseModularHeaders = IOSResolver.PodfileAddUseModularHeaders; podfileStaticLinkFrameworks = IOSResolver.PodfileStaticLinkFrameworks; swiftFrameworkSupportWorkaroundEnabled = IOSResolver.SwiftFrameworkSupportWorkaroundEnabled; @@ -80,6 +82,7 @@ internal void Save() { IOSResolver.CocoapodsIntegrationMethodPref = integrationMapping[cocoapodsIntegrationMenuIndex]; IOSResolver.PodfileAddUseFrameworks = podfileAddUseFrameworks; + IOSResolver.PodfileAddUseModularHeaders = podfileAddUseModularHeaders; IOSResolver.PodfileStaticLinkFrameworks = podfileStaticLinkFrameworks; IOSResolver.SwiftFrameworkSupportWorkaroundEnabled = swiftFrameworkSupportWorkaroundEnabled; @@ -213,7 +216,13 @@ public void OnGUI() { GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); GUILayout.Label("Podfile Configurations", EditorStyles.largeLabel); EditorGUILayout.Separator(); - + + GUILayout.BeginHorizontal(); + GUILayout.Label("Add use_modular_headers! to Podfile", EditorStyles.boldLabel); + settings.podfileAddUseModularHeaders = + EditorGUILayout.Toggle(settings.podfileAddUseModularHeaders); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); GUILayout.Label("Add use_frameworks! to Podfile", EditorStyles.boldLabel); settings.podfileAddUseFrameworks = @@ -348,6 +357,9 @@ public void OnGUI() { new KeyValuePair( "podfileAddUseFrameworks", IOSResolver.PodfileAddUseFrameworks.ToString()), + new KeyValuePair( + "podfileAddUseModularHeaders", + IOSResolver.PodfileAddUseModularHeaders.ToString()), new KeyValuePair( "podfileStaticLinkFrameworks", IOSResolver.PodfileStaticLinkFrameworks.ToString()),