Autocomplete not working in unit test code

Swift, I can't get autocomplete to work for my project code in my unit test target. I'm using the @testable import, and autocomplete works fine for any iOS objects, but for my objects, the ones I actually want to test, it doesn't work at all. Additionally, if I create a variable of one of my types, it shows as "<<error type>>" in autocomplete. Happens in multple projects, happened in XCode 7.1 and also 7.2.


I've tried clearing derived data, the com.apple.dt.Xcode cache file, the project's xcuserdata/*.xcuserdatad file. Nothing helps.


Projects build and run just fine. All unit tests run and pass just fine. But lack of autocomplete is driving me crazy.


Any suggestions?

Hi,


Same problem here.


The only way I managed to solve it was by recreating the targets and setting them up again.


Not sure if related, but I noticed these two things during the process:

- Created the new targets as being Swift, which added some more entries in the target's build settings (the test target had been setup initially as ObjC).

- Had an unnecessary dependency in CocoaPods on my test target. Since the test target depends on the main target (Target Dependency + Link), I didn't need to add the same pod in both targets.


Hope this helps.


Cheers

Try creating a new scheme in which your tests are the only target. It worked for me. Also, ensure that your test target is part of your current scheme.
Autocomplete not working in unit test code
 
 
Q