Skip to content

Instantly share code, notes, and snippets.

@WiesnerPeti
Last active January 3, 2020 12:45
Show Gist options
  • Save WiesnerPeti/47ef4c530d78e90624b0171eae8a4454 to your computer and use it in GitHub Desktop.
Save WiesnerPeti/47ef4c530d78e90624b0171eae8a4454 to your computer and use it in GitHub Desktop.
Pod Post install hook to modify linker flags and framework search attributes
post_install do |installer|
installer.aggregate_targets.each do |aggregate_target|
if aggregate_target.name == "YOUR_TARGET"
aggregate_target.xcconfigs.each do |config_name, config_file|
#Example to get and set attributes
frameworkSearchPaths = config_file.attributes["FRAMEWORK_SEARCH_PATHS"]
config_file.attributes["FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]"] = frameworkSearchPaths
#Example to delete attributes
config_file.attributes.delete("FRAMEWORK_SEARCH_PATHS")
#Example to delete linker flags
config_file.other_linker_flags.clear
#Example to save changes
xcconfig_path = aggregate_target.xcconfig_path(config_name)
config_file.save_as(xcconfig_path)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment