1

Prior to working on the current project, I didn't really have much trouble with Xcode autocomplete. In fact, even when I worked on different but much smaller project, Xcode autocomplete and code highlighting worked well.

However, on the current project I am working on, Xcode doesn't show the standard auto complete with all the methods and variables I can use. It may be of interest that I used GitHub to download the current project on my machine and the project uses a few Pods. Surprisingly, when I was making some changes to one of the Pods last week, autocomplete worked fine in the Pod file but the autocomplete doesn't (and didn't) show in the source files of the actual project. Also I am sure that Indexing is turned on (I turned it on in the terminal and I can see the code being indexed when I start). What I have tried so far (unsuccessfully):

Method 1

Delete derived data, restart Xcode, clean project and build.

Method 2

In the build settings, set Always Search User Paths to Yes

In regards to similar questions such as: Xcode 8.2 Code Completion Not Working, my issue is different because my issue isn't exclusive to scope of extension and none of the answers on that page helped me.

Picture example: This is from **another** project where autocomplete works **correctly**.  This is what I **WANT**

This is (picture above) from another project where autocomplete works correctly. This is what I WANT. Also note how the instance variable shadowBaseView is highlighted in turquoise.

enter image description here

Unfortunately the picture on the bottom is what I get when I press CMD+Space. Also in my current project while classes like UIView are highlighted purple, instance variables are still black.

Jay
  • 133
  • 3
  • 14
  • I get this sometimes and I just reboot my computer to fix it. – CodeBender Jul 12 '17 at 15:02
  • I frequently get have the same issue (and many other XC problems) and I can usually fix it by restarting XCode – Pheepster Jul 12 '17 at 15:06
  • Possible duplicate of [Xcode 8.2 Code Completion Not Working](https://stackoverflow.com/questions/41227787/xcode-8-2-code-completion-not-working) – Tamás Sengel Jul 12 '17 at 15:07
  • @CodeBender I tried restarted Xcode and my Mac but that didn't fix it or help it. – Jay Jul 12 '17 at 15:30
  • @Pheepster Read comment above – Jay Jul 12 '17 at 15:31
  • @the4kman I have looked at the answer on that thread/question, however that isn't my issue because I am not working inside an extension. – Jay Jul 12 '17 at 15:32
  • @Jay Not much I can add, just that I see this issue about once a week in XCode, and restarting the computer (no other actions) fixes it for me. – CodeBender Jul 12 '17 at 15:42

2 Answers2

3

This tends to happen a lot when switching applications. Sometimes you have to wait like 6 seconds for the autocomplete to show up.

Try cleaning your code CMD+SHIFT+K Try building your code CMD+SHIFT+B Also try running it CMD+R

If it still doesn't work, just restart Xcode. It should work!

Erik Batista
  • 227
  • 2
  • 15
0

http://theapplady.net/swift-autocomplete/

Example in swift.

Moreover: Clean -> Build.enter image description here

J A S K I E R
  • 1,976
  • 3
  • 24
  • 42