Code completion also stopped working for me in Xcode 8.2.1, and no amount of cleanup, output, or reboot fixed it. After a while, I realized that code completion was broken only in the extension area that I was working on. If you typed manually, the code will be correctly highlighted and compiled in order, so the problem is not that the source code discards all the parser responsible for completing the code.
Here is the specific context in which this occurs in this very simple example:
struct SomeStruct { static let foobar1 = { return NSBezierPath() }() } extension SomeStruct { static let foobar2 = { return NSBezierPath() }() }
Code completion works fine in the foobar1 implementation foobar1 , but not for foobar2 . This is the presence of static let within the extension, which seems to be causing it. The problem arises for both the structure and the class.
Looks like an error with Xcode, so the only workaround for me was to move foobar2 into the foobar2 main definition.
charles Jan 13 '17 at 16:34 on 2017-01-13 16:34
source share