Using Code completion in XcodeOnce enabled, Xcode will now offer code completion based on what you have typed and offer suggestions for completing the syntax.
Update: As per @Dareon solution below also works for Xcode Version 8.3 (8E162) and 8.3.2 (8E2002). Thanks, @Dareon for the confirmation. :)
I was facing the same issue and following worked for me.
I am using Xcode Version 8.2.1 (8C1002).
At least, it worked for me.
Code completion also stopped working for me in Xcode 8.2.1, and no amount of clean-up, derived data throwaway or restart fixed it. After a while, I realized code completion was only broken within the extension scope I was working on. If typed manually, the code would be correctly highlighted and would compile fine, so it was not an issue of the source throwing off whatever parser is in charge of code completion.
Here is the specific context in which it happens, in this very simple example:
struct SomeStruct {
static let foobar1 = {
return NSBezierPath()
}()
}
extension SomeStruct {
static let foobar2 = {
return NSBezierPath()
}()
}
Code completion works fine within the implementation block of foobar1
, but not for foobar2
. It's the presence of a static let
within an extension that seems to trigger it. The issue appears for both struct and class.
Looks like a bug with Xcode, so the only workaround for me was to move foobar2
into the main definition of SomeStruct
.
Just restarting Xcode worked for me.
Just clean and build your app once on Generic iOS Device
, it might be due to some compile time issue, which disables the intelligence, I am seeing this bug since Xcode 8.2.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With