Is there a way to turn off Xcode 8's autocompl

2020-02-17 04:47发布

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.

3条回答
Anthone
2楼-- · 2020-02-17 05:22

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

查看更多
贪生不怕死
3楼-- · 2020-02-17 05:23

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)

查看更多
成全新的幸福
4楼-- · 2020-02-17 05:33

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.

查看更多
登录 后发表回答