Xcode 7.3 Syntax Highlighting and Code Completion issues with Swift Xcode 7.3 Syntax Highlighting and Code Completion issues with Swift xcode xcode

Xcode 7.3 Syntax Highlighting and Code Completion issues with Swift


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.


So it seems the issue was with CocoaPods. I was using Cocoapods as a static library instead of as frameworks. Switching to frameworks (using use_frameworks! in my Podfile) and importing the libraries into Swift has resolved all my issues. I'm guessing all those third party library headers were just too much for XCode to process. Either way, the issue is now resolved. I hope this helps someone in the future.


This might not be necessary anymore but i still want to post this:

At the time of this post, the most recent version of cocoapods (1.0.0.beta.8) requires you to define pods for each Xcode target.

In my case I had a class compile for the project target and for a testing target. I added a pod only to the main target, because of laziness.

Now working in the code of class A I added the pod framework using import NAME and tried to use the classes of the framework. Xcode wouldn't highlight the particular code where I use the new classes, but compiling and running works fine. In the completion dialog the type of the variable was <<error type>>

The way to resolve this issue: in the Podfile add the newly added pod to all targets, the class A is member of.

Now Xcode finds the necessary frameworks for all targets and code highlighting works again.

EDIT 1:

A possible solution is defining a list of shared pods, like in my example:

platform :ios, '8.4'use_frameworks!inhibit_all_warnings!def all_pods    pod 'MPMessagePack'    pod 'SwiftyDispatch'    pod 'BFKit'    pod 'Timepiece'    pod 'Alamofire'    pod 'AlamofireSwiftyJSON'enddef testing_pods    pod 'Quick'    pod 'Nimble'endtarget 'App' do    all_podsendtarget 'AppLogicTests' do    all_pods    testing_podsendtarget 'AppUITests' do    pod 'RxTest'    all_pods    testing_podsendpost_install do |installer|    installer.pods_project.targets.each do |target|        puts target.name    endend

This will add all pods to all targets and adding all testing pods to the targets. Next to these I added 'RxTest' to the AppUITests.

(Chosen pods are examples of my projects, no advertising intended :-) )