Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 8 syntax highlighting doesn't work

Tags:

The code above has correct syntax highlighting in Xcode 7. It is mix of Obj-C + Swift:

enter image description here

I've updated project to support Xcode 8 and only few things was changed:

  • In Build Settings Swift 2.3 support enter image description here

  • And have fixed few errors related to implicitly unwrapped properties in UIKit enter image description here

After all the project is compiled fine for Xcode 8.

But Obj-C code integrated in Swift doesn't have any syntax highlighting and vice versa:

enter image description here

And there is << error type >> problem with autocomplete: enter image description here

Derived data deleting doesn't help, Xcode restart either :) CocoaPods version 0.38.2, iOS 7

like image 715
Andrey Banshchikov Avatar asked Sep 20 '16 15:09

Andrey Banshchikov


1 Answers

This answer helped me https://forums.developer.apple.com/thread/46223 with one of my projects:

I got help from an apple engineer at WWDC on this issue and resolved it. The problem stemmed from cocoapods... Apparently cocoapods was copying .h files into the build directory and SourceKit was getting confused. I'm not entirely sure why the .h files were being copied - they aren't needed there. So the fix was to add a post-build script in your build phases section that removes the headers after a build.
It would look something like this:

function removeHeaders() {       find $BUILD_ROOT/Debug-iphonesimulator/  -name '*.h' -exec rm -f {} \;   }   removeHeaders   
like image 193
Andrey Banshchikov Avatar answered Oct 13 '22 18:10

Andrey Banshchikov