查看了CocoaPods官方示例(来源于 https://guides.cocoapods.org/syntax/podfile.html#abstract_target )之后:
# Note: There are no targets called "Shows" in any of this workspace's Xcode projects
abstract_target 'Shows' do
pod 'ShowsKit'
# The target ShowsiOS has its own copy of ShowsKit (inherited) + ShowWebAuth (added here)
target 'ShowsiOS' do
pod 'ShowWebAuth'
end
# The target ShowsTV has its own copy of ShowsKit (inherited) + ShowTVAuth (added here)
target 'ShowsTV' do
pod 'ShowTVAuth'
end
# Our tests target has its own copy of
# our testing frameworks, and has access
# to ShowsKit as well because it is
# a child of the abstract target 'Shows'
target 'ShowsTests' do
inherit! :search_paths
pod 'Specta'
pod 'Expecta'
end
end
我不明白为什么需要使用 inherit! :search_paths
?因为所有三个目标,ShowsiOS
、ShowsTV
和 ShowsTests
都可以从它们的父目标中访问 ShowsKit
。
来自 https://guides.cocoapods.org/syntax/podfile.html#inherit_bang 的 inherit!
的具体示例并没有增加任何清晰度。
target 'App' do
target 'AppTests' do
inherit! :search_paths
end
end
你能帮我理解 inherit! :search_paths
是用来做什么的吗?