继承什么! :search_paths吗? [英] What does inherit! :search_paths do?

查看:107
本文介绍了继承什么! :search_paths吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在查看CocoaPods的示例后(来自 https://guides.cocoapods.org/syntax/podfile。 html#abstract_target

After looking at CocoaPods' own example (from 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

我不明白为什么继承! :search_paths 是必要的吗? ShowsiOS ShowsTV ShowsTests 这3个目标均具有访问权限到其父目标的 ShowsKit

I don't see why inherit! :search_paths is necessary? All 3 targets, ShowsiOS, ShowsTV and ShowsTests have access to ShowsKit from their parent target.

继承的具体示例!(来自 https://guides.cocoapods.org/syntax/podfile.html#inherit_bang)不会增加任何清晰度

The specific example for inherit! (from https://guides.cocoapods.org/syntax/podfile.html#inherit_bang) doesn't add any clarity

target 'App' do
  target 'AppTests' do
    inherit! :search_paths
  end
end

您能帮我理解什么继承! :search_paths 是干什么用的?

Can you help me understand what inherit! :search_paths is for?

推荐答案

继承背后的目的! / code>,根据 https://guides.cocoapods.org/syntax/ podfile.html#inherit_bang
(我同意不是很清楚),是要提供3种可用模式之一:

The purpose behind behind inherit!, according to https://guides.cocoapods.org/syntax/podfile.html#inherit_bang (which I would agree is not very clear), is to provide one of 3 available modes:


  • :complete 目标从父级继承所有行为。

  • :无目标不会从父级继承任何行为。

  • :search_paths 目标仅继承父对象的搜索路径。

  • :complete The target inherits all behaviour from the parent.
  • :none The target inherits none of the behaviour from the parent.
  • :search_paths The target inherits the search paths of the parent only.

在此问题中例如,表示的是:search_paths 模式。在测试Pod项目时,三种不同的模式扮演着不同的角色。

In this question's example it is the :search_paths mode that is being expressed. The three different modes serve different roles when testing a Pod project.

这是与Xcode中的框架搜索路径有关的附加链接,它帮助我消除了一些困惑。

Here is an additional link pertaining to Framework Search Paths in Xcode that helped clear some confusion for me.

这篇关于继承什么! :search_paths吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆