Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to turn off Xcode 8's autocomplete for image names?

Xcode 8 has this new feature that is supposed to suggest image file names when you use UIImage(named:)

In my case it suggests image names even when it doesn't make any sense.

Example:

Example autocomplete image

There is nothing in preferences. I wonder if there is some secret command to disable this part of autocompletion.

like image 883
Vojtech Vrbka Avatar asked Sep 28 '16 10:09

Vojtech Vrbka


People also ask

How do I disable code completion in Xcode?

Click the Xcode menu and select Preferences from the menu list. In the Preferences window, navigate to Text Editing Preferences then Code Completion under the Editing section. Unmark the check box with caption as “Suggest completion while typing“. This should turn off the code completion feature in Xcode.

How do I use autocomplete in Xcode?

Go to Xcode > Preferences > Text Editing again. Quit out of Xcode and then relaunch Xcode. Now go to Code completion and check 'Suggest completions while typing'. Try typing library function or enum and enjoy!


3 Answers

No this unfortunately can't be turned off, and nothing states that this is fixed in the Xcode 8.1 Release Notes.

It should either be fixed or you should have the opportunity to turn it off. The functionality is kind of good when it´s used for it´s purpose only, as I describe in this post.

But the issue is that Xcode 8 is inserting images inline in source when it can't possibly make any sense as you mention. For example, if you have a for iteration and type for x in to start a loop and you have any image in the project whose name matches "in" using this syntax.

Annoying issue, that I hope Apple will fix soon, because the feature is good when it´s used for images only.

Update:
Just confirmed that this is still an issue in Xcode 8.1 stable version.

Update:
This functionality remains in Xcode Version 9.0 beta 6 (9M214v) enter image description here

Update

This seems to be fixed in Xcode 10 now.

like image 176
Rashwan L Avatar answered Oct 12 '22 16:10

Rashwan L


It seems to me that the best way to deal with this issue is by using comments (commmand + /). Changing the code to become a comment seems to turn off the autocomplete for image names.

So, you would have basically to switch back and forth between commenting and uncommenting your code (e.g. you find an error, make your code as a comment, fix the error, uncomment your code, check if your changes fixed the issue, and so on.).

Example of the same code with and without being a comment. The line of code with and without a comment

like image 2
Ibrahim Avatar answered Oct 12 '22 17:10

Ibrahim


Simply update to Xcode 10: the image autocompletion feature has been discontinued:

Code Completion for Swift image literals has been removed in Xcode 10. (38087260)

Source: the Xcode 10 Beta release notes (this note was removed in the final release notes)

like image 1
Cœur Avatar answered Oct 12 '22 17:10

Cœur