Files
streamyfin/plugins/withSwiftUICoreWeakLink.js
Gauvain 3c7292b73b 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]
2026-05-29 00:50:57 +02:00

56 lines
1.9 KiB
JavaScript

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;
});
};