Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
197 views
in Technique[技术] by (71.8m points)

ios - Xcode 7.3 Syntax Highlighting and Code Completion issues with Swift

I am having an extremely frustrating issue with XCode 7.3 (however, this issue has persisted since I installed XCode 7.2) and Swift code, and I am hoping others have had this issue and know how to resolve it. Syntax highlighting and code completion work perfectly fine in Objective-C files, and also works fine when calling other Swift objects within Swift code. However, any Objective-C objects or methods mentioned in Swift code get no syntax highlighting, and XCode will not complete ANY Objective-C declared methods or properties. Everything compiles and runs just fine.

I should also add that I have also tried doing a completely clean install of XCode. I deleted all my derived data, deleted all XCode caches, and deleted my XCode preferences files (in addition to obviously deleting the XCode.app archive before re-installing).

It is making it extremely difficult to develop in Swift. I don't want to do this, but if I can't find a way to resolve this I'll be forced to go back to using Objective-C.

question from:https://stackoverflow.com/questions/36165865/xcode-7-3-syntax-highlighting-and-code-completion-issues-with-swift

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I have the same problem. But finally solved it. I make two change, not sure which is the key point but you can try them all.

  1. delete the module cache

Within the same folder as your project's Derived Data is a Module Cache. When Code Completion stopped working, deleting this fixed it.

Close Xcode and delete the ~/Library/Developer/Xcode/DerivedData/ModuleCache directory.

  1. change the Enable Modules value

Go to the Build Settings of your target, then search Enable Modules

If it's Yes, change it to No, and you may get some build error, just change it back to Yes.

After two steps above you should Clean(Shift+Command+K) your project.

For now you may fixed the problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...