简体   繁体   English

Xcode不会建议或自动完成或连接

[英]Xcode wont suggest or autocomplete or connect

Hi from this morning i've got a weird thing ! 嗨,从今天早上开始,我有一件奇怪的事!

Xcode won't Suggest , Xcode不会Suggest

won't AutoComplete , 不会AutoComplete

won't give color to my codes , 不会给color to my codescolor to my codes

wont give me any Errors and won't find out my properties or methods or anything ! 不会给我任何Errors ,也不会find out我的属性或方法或任何东西!

But indexing compelete with success 但是索引成功

Build compelete with success 建立成功的竞争

Run compelete with success 成功竞争

在此处输入图片说明

Restart your Xcode. 重新启动您的Xcode。 If still not work, restart your computer. 如果仍然无法正常工作,请重新启动计算机。

I Had same problem , and i have solutions for that : 我遇到了同样的问题,对此我有解决办法:

1.DerivedData : 1. DerivedData:

Xcode caches some files that cause this problem Xcode缓存一些导致此问题的文件

Go to --> YourUserName/Library/Developer/Xcode/ 转到-> YourUserName/Library/Developer/Xcode/

Then remove the DerivedData directory in the Xcode directory 然后删除Xcode目录中的DerivedData目录

if you didnt saw Library folder because it is a hidden directory 如果您没有看到Library文件夹,因为它是一个隐藏目录

Here is a good Resource of how to show hidden files in macOS 这是如何在macOS中显示隐藏文件的好资源

2.Memory 2.内存

clean up some memory , on devices that have 8GB of RAM this problem Occurred more 清理一些内存,在具有8GB RAM设备上,会出现更多此问题

I suggest you to use CleanMyMac3 it also free a lot of Storage 我建议您使用CleanMyMac3它还可以释放大量Storage

You can download it from here 你可以在这里下载

3.Code Clean ! 3.代码干净!

I suggest you to code clean first ! 我建议您先编写干净的代码!

a few things that i used to do in my Projects : 我过去在专案中做过的几件事:

  1. For every method that only belongs to body of that class use fileprivate which means this method is available for the class and extenstions which just private is only available to the body of the class 对于仅属于该类主体的每个方法,请使用fileprivate ,这意味着该方法可用于该类和扩展,而仅private可用于该类的主体

  2. Any property that belongs only to body of the class should mark with fileprivate 任何仅属于类主体的属性都应标记为fileprivate

  3. Avoid of declaring variables outside of the class ! 避免在类外声明变量! this will get memory all the time 这将一直获得内存

  4. Deinit() the Models after you end up working with them Deinit()使用Models后,请对它们进行Deinit()

  5. Avoid of doing Notification Center because you forget to dispose them ! 避免执行Notification Center因为您忘记处理它们! instead of that i suggest you to start RxSwift that works better you can find it here 而不是我建议您启动效果更好的RxSwift ,您可以在这里找到它

RxSwift RxSwift

4. Code Completion 4.代码完成

go to the Xcode->Preferences->TextEditing 转到Xcode-> Preferences-> TextEditing

Check that is your code completion options is checked to true 检查您的代码完成选项是否选中为true

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM