PodKit is a tiny extension for overcoming some CocoaPods "oversights" – it adds several handy instructions on top of existing Podfile directives, allowing to customize the integration
Adding PodKit to a project can be done via a Git dependency:
git submodule add https://github.com/Bitwild/PodKit dependency/Git/PodKit
git submodule update --init --recursive
Then added into a Podfile using require_relative
:
require_relative 'Git/PodKit/source/pod_kit'
# Include base configuration per-target types.
configure :application, 'xcconfigs/macOS/macOS-Application.xcconfig'
configure :framework, 'xcconfigs/macOS/macOS-Framework.xcconfig'
configure :test, 'xcconfigs/macOS/macOS-XCTest.xcconfig'
# Use custom location for CocoaPods groups.
group 'Dependencies/CocoaPods'
# Change / remove standard "[CP]" and "[CP User]" prefix from target build phases.
pretty :build_phase_prefix, 'Pods -'
pretty :user_build_phase_prefix, 'Pods User -'
# Use custom naming separator instead of "-".
pretty :naming_delimiter, ' - '
# Set up install hooks.
pre_install { |installer| PodKit.pre_install(installer) }
post_install { |installer| PodKit.post_install(installer) }
project '…'
target '…' do
pod '…', '~> 1.0.0'
end
Use custom location for CocoaPods's Frameworks
and Pods
groups, by default they will be added at the top level of Xcode project. You might want to keep it clean and store them at a different location.
group 'Some/Path'
Include relative *.xcconfig
Xcode build configuration file for all target types – handy when using xcconfigs. CocoaPods sets its own per-target configuration, so you no longer can use yours in Xcode project info. This effectively allows to include a custom *.xcconfig
file into configuration generated by CocoaPods. Supported target types:
:application
:dynamic_library
:framework
:static_library
:test
:xpc
configure :application, 'xcconfigs/macOS/macOS-Application.xcconfig'
configure :framework, 'xcconfigs/macOS/macOS-Framework.xcconfig'
configure :test, 'xcconfigs/macOS/macOS-XCTest.xcconfig'
Set custom CocoaPods build phase prefix – if you want your configuration looking pretty and consistent. Note, phases should use different prefixes, otherwise :build_phase
will always get removed resulting in undefined behaviour. Use with caution!
pretty :build_phase_prefix, ''
pretty :user_build_phase_prefix, 'Pods User -'
Set custom delimiter for CocoaPods-generated support files – if you're using custom schemes, like Debug - Foo
, Release - Bar
and want the rest of the configuration looking consistent.
pretty :naming_delimiter, ' - '