const {CodeGenerator, withPodfile} = require('expo/config-plugins') const MINIMUM_IOS_VERSION = '16.4' const withMinimumIOSDeploymentTarget = config => withPodfile(config, config => { const targetOverride = ` installer.pods_project.targets.each do |target| target.build_configurations.each do |build_config| current = build_config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] if current.nil? || current.to_f < ${MINIMUM_IOS_VERSION} build_config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '${MINIMUM_IOS_VERSION}' end end end` config.modResults.contents = CodeGenerator.mergeContents({ tag: 'witchsky-minimum-ios-deployment-target', src: config.modResults.contents, newSrc: targetOverride, anchor: /^\s*:ccache_enabled => ccache_enabled\?\(podfile_properties\),$/, offset: 2, comment: '#', }).contents return config }) module.exports = withMinimumIOSDeploymentTarget