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.


Solution 1:

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.

Solution 2:

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

Solution 3:

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)