41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
const {
|
|
withPodfile,
|
|
withPodfileProperties,
|
|
withXcodeProject,
|
|
} = require("expo/config-plugins")
|
|
|
|
// Opt in during prebuild so normal iOS builds keep their precompiled dependencies.
|
|
module.exports = (config) => {
|
|
config = withPodfileProperties(config, (config) => {
|
|
config.modResults["ios.buildReactNativeFromSource"] = "true"
|
|
config.modResults.EXPO_USE_PRECOMPILED_MODULES = "false"
|
|
return config
|
|
})
|
|
|
|
config = withPodfile(config, (config) => {
|
|
const pattern = /:mac_catalyst_enabled\s*=>\s*(?:false|true)/
|
|
if (!pattern.test(config.modResults.contents)) {
|
|
throw new Error("Cannot enable Catalyst: Expo's Podfile template has changed")
|
|
}
|
|
config.modResults.contents = config.modResults.contents.replace(
|
|
pattern,
|
|
":mac_catalyst_enabled => true"
|
|
)
|
|
return config
|
|
})
|
|
|
|
return withXcodeProject(config, (config) => {
|
|
const project = config.modResults
|
|
const target = project.getFirstTarget().firstTarget
|
|
const lists = project.pbxXCConfigurationList()
|
|
const configurations = project.pbxXCBuildConfigurationSection()
|
|
for (const { value } of lists[target.buildConfigurationList].buildConfigurations) {
|
|
const settings = configurations[value].buildSettings
|
|
settings.SUPPORTS_MACCATALYST = "YES"
|
|
settings.DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = "YES"
|
|
settings.TARGETED_DEVICE_FAMILY = '"1,2"'
|
|
}
|
|
return config
|
|
})
|
|
}
|