Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autocomplete not working for test files

Tags:

xcode

Code completion has been a continuing issue for me and lately there's been a new wrinkle. Normally I can just delete the derived data folder and rebuild, sometimes having to exit Xcode, but now I've hit an issue I can't solve.

Auto complete is working in my base project, by that I mean if I'm in a file that is building with the program, code completion works. But if I start writing a test case in a code module that builds with the test target) completion will not work with any of the main target classes or variables.

I have @testable import [target] and it's been working in the past.

The only thing I've done recently is move my repo off my iCloud drive because it was causing Xcode to crash whenever a did a pull onto a local hard drive location.

Is there some location in the project settings that determine where Xcode looks? Is there some hidden cache I need to delete? programming without code completion is a nightmare.

Using the latest 8.2.1 Xcode with all my code in Swift 3.

like image 526
danielweberdlc Avatar asked Feb 15 '17 01:02

danielweberdlc


1 Answers

I have encountered the same problem under Xcode 10.1. The issue seemed to be related to the Build configuration settings of the currently used scheme. Namely, mine were different for the different actions, e.g. Release for the Run action and Debug for the Test action. Changing the build configuration of the Run action to Debug (thus matching the test action one) fixed the issue for me.

Steps I used:

  1. Select your scheme (top left)

  2. Select "Edit scheme"

  3. Make sure the Test and Run actions are using the same build configuration

    3.1 If not, select the corresponding action (Test or Run), choose the "Info" tab and change the Configuration from the corresponding picker

like image 103
Ivan S Ivanov Avatar answered Oct 08 '22 12:10

Ivan S Ivanov