Skip to content

Instantly share code, notes, and snippets.

@csknns
Last active September 1, 2020 20:06
Show Gist options
  • Save csknns/7a8faa6497770c6d93ecf610ae35903a to your computer and use it in GitHub Desktop.
Save csknns/7a8faa6497770c6d93ecf610ae35903a to your computer and use it in GitHub Desktop.
Post integration Cocoapods hook workaround
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'TargetName' do
end
class Pod::Installer
# The only way to run my custom method after the pod integrates with the project (http://blog.bigbinary.com/2012/01/08/alias-vs-alias-method.html)
# Repace the method implementation integrate_user_project with ours
alias_method :integrate_user_project_old, :integrate_user_project
def integrate_user_project
# integrate with the user project
integrate_user_project_old
# run custom post_integrate_method
patch_pod_xcconfig_files
end
def post_integrate_method
# Add your post integrate code here
end
end
@MaxLarue
Copy link

MaxLarue commented Sep 1, 2020

hacky wacky but worky for me 👍

had to change patch_pod_xcconfig_files to post_integrate_method though (and i think it makes more sense in the gist).

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment