Last active
October 12, 2023 08:40
-
-
Save bizz84/737ee3234615a1ade7b304ce1189b599 to your computer and use it in GitHub Desktop.
iOS Podfile template for Flutter apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the platform at the top | |
platform :ios, '13.0' | |
# Rest of the pod file | |
# Update post_install step | |
post_install do |installer| | |
# Ensure pods use the minimum deployment target set above | |
# https://stackoverflow.com/a/64385584/436422 | |
pods_project = installer.pods_project | |
deployment_target_key = 'IPHONEOS_DEPLOYMENT_TARGET' | |
deployment_targets = pods_project.build_configurations.map{ |config| config.build_settings[deployment_target_key] } | |
minimum_deployment_target = deployment_targets.min_by{ |version| Gem::Version.new(version) } | |
puts 'Setting each pod deployment target to ' + minimum_deployment_target | |
installer.pods_project.targets.each do |target| | |
flutter_additional_ios_build_settings(target) | |
target.build_configurations.each do |config| | |
config.build_settings[deployment_target_key] = minimum_deployment_target | |
# DT_TOOLCHAIN_DIR fix for Xcode 15 | |
# https://stackoverflow.com/a/77142190 | |
xcconfig_path = config.base_configuration_reference.real_path | |
xcconfig = File.read(xcconfig_path) | |
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR") | |
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment