简体   繁体   English

Xcode:项目的Swift版本与可可豆荚的Swift版本

[英]Xcode: Swift version of project vs. Swift version of cocoa pods

I am writing an iOS app in Xcode and it's all working fine. 我正在用Xcode编写iOS应用程序,并且一切正常。 However, I have always wondered why it is that in build settings of my project I can specify a Swift language version, and I can also specify one for each cocoa pod. 但是,我一直想知道为什么在我的项目的构建设置中可以指定一种Swift语言版本,并且还可以为每个可可豆荚指定一个版本。 Can these really be specified independently? 这些真的可以单独指定吗?

Also, I have recently changed the Swift version of my project from 3.3 to 4.1, but this change did not affect the Swift language setting in the cocoa pods (which was still shown as 3.3). 另外,我最近将项目的Swift版本从3.3更改为4.1,但此更改并未影响可可豆荚中的Swift语言设置(仍显示为3.3)。 However, when manually changing the Swift language version of one of the pods to 4.1, everything still ran fine. 但是,当将其中一个Pod的Swift语言版本手动更改为4.1时,一切仍然正常。

Is there a risk that if I use a cocoa pod which is not updated in time for the release of new Swift versions that this then causes problems as I cannot update the Swift version of the whole project when I want? 如果我使用的可可豆荚没有及时更新以发布新的Swift版本,是否存在风险,因为我无法在需要时更新整个项目的Swift版本,这会引起问题吗?

Anyway, I just can't make sense of the relationship but am really interested in the answer and would love to understand. 无论如何,我只是无法理解这种关系,而是对答案非常感兴趣,并且很愿意理解。

The version of the Swift language that the compiler uses is configured independently as a build setting for each target in your project. 编译器使用的Swift语言版本被独立配置为项目中每个目标的构建设置。

And this makes sense for the very reason your example presupposes: you might be using a framework whose language version is different from your main app target's language version. 这是有道理的,因为您的示例具有以下前提:您使用的框架的语言版本与您主要应用目标的语言版本不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM