Xcode 7.3: import Module displayed with strikethrough

我与影子孤独终老i 提交于 2019-11-30 13:49:22
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.

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

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.

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

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

For example, UIKit is already imported with Foundation so you don't need to import it manually.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!