Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The module required to be imported but displayed in strikethrough font in Xcode 7.3 [duplicate]

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

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.

like image 554
derdida Avatar asked Mar 23 '16 14:03

derdida


4 Answers

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.

like image 128
Xi Ge Avatar answered Oct 19 '22 12:10

Xi Ge


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.

like image 44
JAL Avatar answered Oct 19 '22 12:10

JAL


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.

enter image description here

like image 23
Abhijith Avatar answered Oct 19 '22 12:10

Abhijith


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
like image 45
brian.clear Avatar answered Oct 19 '22 10:10

brian.clear