7

UPDATE:

@JAL has pointed out to the accepted SO answer which suggests that the behaviour described in this question is a BUG which is now supposed to be fixed. There is no indication of when this fix goes live, though.

PREVIOUS UPDATE:

As this answer suggests, Xcode displays import <module_name> in strikethrough font when it decides the import is redundant (which I assumed in the original question below). BUT without the import <module_name> compiler is failed with the error.

This kind of misbehaviour is the subject of my original question. Is it bug or am I missing something (e.g. correct linking to the framework, etc..)?

ORIGINAL QUESTION:

What does it mean when Xcode, suggesting import module as I type, displays the required module name in strikethrough font?

enter image description here

Description:

I want to create simple GKEntity subclass. So, in new .swift file I add the following:

class TBTEntity: GKEntity {

}

I know that GKEntity itself is a part of GameplayKit framework. So, I have to import the framework, otherwise, I see the error.

enter image description here

Use of undeclared type 'GKEntity'

Strikethrough font from UX perspective suggests me something like "you ain't gonna need this" or "the module is not available", but none of this seems to be true in fact.

Xcode 7.3 (7D175)

Community
  • 1
  • 1
Yevhen Dubinin
  • 4,657
  • 3
  • 34
  • 57
  • The [Xcode 7.3 beta release notes](http://adcdownload.apple.com/Developer_Tools/Xcode_7.3_beta_4/Xcode_7.3_beta_4_Release_Notes.pdf) do mention improvements in the code completion (sense), so this behaviour has probably been introduced with those (intended) improvements. I don't have the 7.3 beta installed myself; can you see the same behaviour for code completion when attempting to import any random module? (say `import a ...`) Would be interesting to see if this is present also in the recently released beta 4. If no one can explain this, consider filing a radar. – dfrib Feb 27 '16 at 16:16
  • @dfri I don't have Beta 4 around with me so far, but thank you for a hint! Suggestions has definitely been improved in this Beta. – Yevhen Dubinin Feb 27 '16 at 16:22
  • I am on Xcode 7.3 beta 5 (7D162j), the behaviour is the same. – Yevhen Dubinin Mar 03 '16 at 11:08
  • I see, good with double-check. I'd suggest you file a radar for this; worst case scenario, you'd get a plausible explanation from there. Once resolved (bug or valid explanation?), consider adding an answer to you own question here. – dfrib Mar 03 '16 at 11:11
  • I have done that. Will update the question. – Yevhen Dubinin Mar 05 '16 at 13:17
  • And you can still reproduce this with Xcode 7.3 stable? – JAL Mar 23 '16 at 16:26
  • @JAL yes. I have tried it and updated the question with the Xcode build number (current release). – Yevhen Dubinin Mar 23 '16 at 16:29
  • I don't see this issue in the new XCode and I am using GameplayKit. Great framework BTW. – John Difool Mar 23 '16 at 16:29
  • I have added a new Swift file and copy-pasted the code from the question. Without `import GameplayKit` at the top of the file, I cannot build the project. Same error. – Yevhen Dubinin Mar 23 '16 at 16:37
  • I've nominated this question for reopening, since you edit shows the differences between your question and the dupe target. – JAL Mar 23 '16 at 20:37
  • @John Difool I am now at some local watchOS app development class and everybody wonder why `import CoreLocation` is displayed in strikethrough font. :) – Yevhen Dubinin Mar 24 '16 at 17:55
  • What happen when you remove the line and compile the project? From the duplicate answer, it seems that you shouldn't need to import it twice if another module has already imported it. – John Difool Mar 24 '16 at 18:50
  • @John Difool I have already mentioned it in the question. The compile error appears. – Yevhen Dubinin Mar 24 '16 at 19:02
  • Is your question now a duplicate because of the linked question because it was a bug? See the [accepted answer](http://stackoverflow.com/a/36212392/2415822). – JAL Apr 05 '16 at 21:22
  • @JAL sounds like that. However, I don't have my bug report (24973238) to Apple neither "resolved" nor marked as "duplicate", but not a big deal, really. Thank you. – Yevhen Dubinin Apr 05 '16 at 21:40

0 Answers0