Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
frednrks
7,598 PointsWhy is UIKit and Foundation shown with strikethrough when I try to import them into Xcode files?
When I try to add an import statement for UIKit and Foundation I am unable to. Instead Xcode shows UIKit and Foundation with strikethrough. Why does this happen and where can I find documentation to explain why it is happening?
1 Answer
Teodor Garzdin
5,572 PointsThe strikethrough, appears when the module is already imported. That means that either it was imported directly:
import UIKit
or the imported module is already a part of a module you imported. For example if you import Foundation, you don't need to import CoreFoundation, as it is already part of the Foundation module.
frednrks
7,598 Pointsfrednrks
7,598 PointsThanks for explaining that to me Teodor. The reason that it had become an annoyance was at times when working through the tutorials Xcode doesn't seem to find the modules. For example I included UIKit in one follow along and Xcode was not recognising that the module had been imported elsewhere. Do you know how to overcome this. Presently I just rewrite the import module statement. Thanks again Teodor I really appreciate your help.