From 3c7292b73bbf922bcaab860e061b9b1b45ae38c0 Mon Sep 17 00:00:00 2001 From: Gauvain Date: Fri, 29 May 2026 00:50:57 +0200 Subject: [PATCH] fix(ios): weak-link SwiftUICore for iOS 26 build (SDK 56) iOS phone archive failed at Ld: "cannot link directly with 'SwiftUICore' because product being built is not an allowed client of it" (a Liquid Glass / SwiftUI pod pulls SwiftUICore). Add a Podfile config plugin that weak-links SwiftUICore on the app target(s). iOS-only; tvOS unsigned already builds. [unsigned: GPG passphrase unavailable while user away; re-sign on merge] --- app.json | 1 + plugins/withSwiftUICoreWeakLink.js | 55 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 plugins/withSwiftUICoreWeakLink.js diff --git a/app.json b/app.json index 3326f4e4a..833850547 100644 --- a/app.json +++ b/app.json @@ -132,6 +132,7 @@ ], "expo-web-browser", ["./plugins/with-runtime-framework-headers.js"], + ["./plugins/withSwiftUICoreWeakLink.js"], ["./plugins/withChangeNativeAndroidTextToWhite.js"], ["./plugins/withAndroidAlertColors.js"], ["./plugins/withAndroidManifest.js"], diff --git a/plugins/withSwiftUICoreWeakLink.js b/plugins/withSwiftUICoreWeakLink.js new file mode 100644 index 000000000..3f7bd3cf3 --- /dev/null +++ b/plugins/withSwiftUICoreWeakLink.js @@ -0,0 +1,55 @@ +const { withPodfile } = require("expo/config-plugins"); + +// iOS 26 / Xcode 26: some pods (Liquid Glass / SwiftUI-based, e.g. +// react-native-glass-effect-view, @expo/ui) pull in SwiftUICore, which cannot +// be linked directly ("not an allowed client of it"). Weak-linking SwiftUICore +// on the app target(s) satisfies the linker. iOS-only; tvOS is unaffected. +const PATCH_START = "## >>> swiftuicore weak link"; +const PATCH_END = "## <<< swiftuicore weak link"; + +function buildPatch() { + return [ + PATCH_START, + " installer.aggregate_targets.each do |aggregate_target|", + " aggregate_target.user_project.native_targets.each do |target|", + " target.build_configurations.each do |cfg|", + " flags = cfg.build_settings['OTHER_LDFLAGS'] || '$(inherited)'", + " flags = flags.join(' ') if flags.is_a?(Array)", + " unless flags.include?('SwiftUICore')", + " cfg.build_settings['OTHER_LDFLAGS'] = flags + ' -weak_framework SwiftUICore'", + " end", + " end", + " end", + " aggregate_target.user_project.save", + " end", + PATCH_END, + ].join("\n"); +} + +module.exports = function withSwiftUICoreWeakLink(config) { + return withPodfile(config, (config) => { + let podfile = config.modResults.contents; + + if (!/^\s*post_install\s+do\s+\|installer\|/m.test(podfile)) { + podfile += "\n\npost_install do |installer|\nend\n"; + } + + const patch = buildPatch(); + + if (podfile.includes(PATCH_START)) { + podfile = podfile.replace( + new RegExp(`${PATCH_START}[\\s\\S]*?${PATCH_END}`), + patch, + ); + } else { + podfile = podfile.replace( + /^\s*post_install\s+do\s+\|installer\|.*$/m, + (match) => `${match}\n\n${patch}`, + ); + } + + console.log("✅ withSwiftUICoreWeakLink: Podfile updated"); + config.modResults.contents = podfile; + return config; + }); +};