Xcode 13.2.1 - code completion failing quite often - rebuild?

Code completion is more or less defunct in 13.2.1 on my system. Almost all functions from Apple frameworks have "everything" as a suggestion for code completion. Xcode does not prioritize the actual method fingerprint up top.

E.g. HKSampleQuery from HealthKit does not list the available overloads.

Further, jumping to declaration does not work most of the times as well as looking up documentation.

At least SwiftUI previews are working again which failed in 13.2.

Does anybody have a hint if there is a command line parameter to advise Xcode to rebuild its code completion index?

Quick Help also doesn't work properly. Refactor is also broken.

The indexer has most likely failed in this instance due to some possible circular import reference in the codebase. Closing and reopening Xcode usually helps

Same, even on a blank new template project.

I'm experiencing this as well on a brand new project (Mac App). For me, none of the SwiftUI views provide any completions for their constructors. However, my own Views do suggest code completions. Installed Xcode 13.2.1 from the App Store.

Did any of you see the "Install required components" request / dialog when installing Xcode? I did not.

That modal says: "Xcode requires additional components to support running and debugging. Choose Install to add required components."

That sounds like the problem, no?

When I run:

sudo /usr/bin/xcodebuild -runFirstLaunch -verbose

objc[3862]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1e79a2b90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1040e02c8). One of the two will be used. Which one is undefined.

objc[3862]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1e79a2be0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1040e0318). One of the two will be used. Which one is undefined.

And then nothing happens. Oy.

New information that I'm not at all sure is helpful.

I installed (from downloads):

  • Xcode 13.1
  • Xcode 13.2
  • Xcode 13.2.1

If I open my project in Xcode 13.1, clean, build, then attempt to do something like let x = String( I get all the string constructors as you'd expect. AND, quick help works.

If I then close 13.1, open the project in Xcode 13.2(.1) and attempt to do let x = String( I ALSO get all the string constructor completions. However, if I then clean, the completions no longer work. If I build after cleaning, the completions no longer work.

So, Xcode 13.1 is doing something that the 13.2 series is not doing. As long as that build/Xcode cache (or whatever it is) remains from a 13.1 build, Xcode 13.2 can use it for completion.

«MacOS 12.1»

Ok, if any of you are still here, did you enable that "make builds faster" mode with Xcode 13.2?

defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1

That thing?

Try:

defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 0

and see if it turns the completion and quick-help back on. Seems to work for me.

FYI, I went back to 13.1 and I can create apps again. Obviously, not for the latest versions of iOS. I am hoping for a fix in the new year as I see a lot of people struggling with 13.2.

At least for me, this is fixed in Xcode 13.3 beta. I can enabled the EnableSwiftBuildSystemIntegration switch and code completion works. The FB I filed had about 10 other reports, too, so I hope that between all of us, they found the issue.

Xcode 13.2.1 - code completion failing quite often - rebuild?
 
 
Q