SwiftPods

Documentation / 03

Installation hooks

Ruby helpers and hooks execute with your separately installed Ruby. SwiftPods exposes supported public installation objects and saves supported Xcode project changes made by hooks.

Hook phases

HookWhen it runs
pre_installBefore generating dependency projects.
pre_integrateBefore Xcode integration.
post_installAfter project generation, before saving supported changes.
post_integrateAfter integration has completed.

Set a build setting

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |configuration|
      configuration.build_settings['MY_BUILD_FLAG'] = 'YES'
    end
  end
end

Inspect public headers

post_install do |installer|
  installer.pod_targets.each do |target|
    target.file_accessors.each do |accessor|
      puts "#{target.name}: #{accessor.public_headers.length} public headers"
    end
  end
end

Keep Ruby helpers

require_relative './scripts/dependencies'

target 'MyApp' do
  shared_dependencies
end

Use public APIs supported by the selected runtime profile. Unsupported operations produce an explicit diagnostic. Private monkey patches and arbitrary plugin internals are outside the general compatibility promise; plugin versions need their own verified profile.