Xcode 7.3:导入模块显示有删除线

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36180575/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 08:39:26  来源:igfitidea点击:

Xcode 7.3: import Module displayed with strikethrough

iosxcodeswiftxcode7.3

提问by derdida

After upgrading Xcode to 7.3, I just found that some modules are stricken out while importing, like in this screenshot:

将 Xcode 升级到 7.3 后,我刚刚发现导入时某些模块被删除,如下图所示:

But after adding the module (so just pressing enter) everything is fine. What does that mean? The module here is written in Swift and works fine.

但是在添加模块后(所以只需按enter)一切都很好。这意味着什么?这里的模块是用 Swift 编写的并且运行良好。

采纳答案by Xi Ge

This is a bug. We have fixed it in 218010af, which should be included in the Swift 2.2.1 release and is included in the 2016-04-12-a developer snapshot.

这是一个错误。我们已在218010af 中修复它,它应该包含在 Swift 2.2.1 版本中,并包含在2016-04-12-a 开发人员快照中

回答by JAL

The strikethrough occurs if you try to import a module that has already been imported by your file or module:

如果您尝试导入已由您的文件或模块导入的模块,则会出现删除线:

import

进口

In this case, I have already imported Foundation (which implicitly imports CoreFoundation), so Xcode is telling you that there is no need to import either module again.

在这种情况下,我已经导入了 Foundation(它隐式导入了 CoreFoundation),因此 Xcode 告诉您无需再次导入任一模块。

回答by Abhijith

It usually happens when a framework is already imported by any other framework you have already been imported.

当一个框架已经被您已经导入的任何其他框架导入时,通常会发生这种情况。

For example, UIKitis already imported with Foundationso you don't need to import it manually.

例如,UIKit已经与Foundation 一起导入,因此您无需手动导入它。

enter image description here

在此处输入图片说明

回答by brian.clear

I changed the order of the imports

我改变了进口的顺序

import Foundation
import UIKit
import LayerKit
import Atlas  < red line


import Foundation
import UIKit
import Atlas
import LayerKit

Some notes that may be causing it:

可能导致它的一些注意事项:

  • LayerKit importing Atlas even though LayerKit is the lower level API Atlas is the UI layer

  • Both were Cocoapod imports

  • Error appeared when I created an 2nd Schema for App Store/Enteprise releases and cleaned one and switch to the other.

  • Deleting Derived Data didnt clear it.
  • So tried rearranging them and red line disappeared
  • LayerKit 导入 Atlas 即使 LayerKit 是较低级别的 API Atlas 是 UI 层

  • 两者都是 Cocoapod 进口

  • 当我为 App Store/Enteprise 版本创建第二个架构并清理一个并切换到另一个时出现错误。

  • 删除派生数据并没有清除它。
  • 所以尝试重新排列它们,红线消失了