Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 6 code editor erratic behaviour

As of recently I experience some troubles with Xcode's 6 code editor, which conclude in rapid change of focus in the editing window, jumping to a completely different place in the same file, while editing text. This is how it all started. Lately the editor refuses to scroll up and down, hangs, stops displaying the line numbers, or any other text altogether. What can I do to make it stop misbehave? All the solutions I found thus far are concerning older versions of Xcode and do not work for me.

Update: I initially thought it was the Optionals. There is a point in my code where I do this:

tile?.position.vertical >= 2

I presumed that by comparing the optional to a value, I messed with the compiler and I was supposed to compare it only to nil. Subsequent testing proved me wrong. Then I notices something in one of my enumerations:

enum Figure: Int {
     case King = 0
     case Pawn = 1
     case Bishop = 3
     case Knight = 5
     case Rook = 7
     case Queen = 9

     func pieceName() -> String {
        switch self {
        case .Pawn:
            return "Pawn"

        case .King:
            return "King"

        case .Bishop:
            return "Bishop"

        case .Knight:
            return "Knight"

        case .Rook:
            return "Rook"

        case .Queen:
            return "Queen"
        }
    }
}

Notice how nicely the code gets coloured in the switch statement, obviously Pawn, King and so on are a part of the same enumeration. Well, not in my case. My copy of Xcode will say "Symbol not found" when I command-click one of the case values in the function. So, what do you think could this be the culprit to my troubles and if yes, how can I fix it?

like image 947
Христо Узунов Avatar asked Nov 05 '14 15:11

Христо Узунов


2 Answers

Equalise all font sizes and remove any italics and bolds in your colour theme.

The answer to this issue I discovered in the Apple Developer forums. Unfortunately, I cannot find the thread there. It basically said that the behaviour I was experiencing was the result of a colour theme I was using having different sized fonts and a combination of italics and bolds. The thing is that there were no more comments after this guy's post, confirming or disproving the solution. For me, it did the thing. And now that @Kirby Todd has confirmed it, I am posting it as an answer.

like image 177
Христо Узунов Avatar answered Nov 09 '22 05:11

Христо Узунов


This was happening to me in Xcode 7.1.1 (7B1005). It got so bad I went back to vi for a while!

I considered the discussion above, but I never adjusted my fonts and was using the defaults. I'm on an MacBook Air. There wasn't enough memory pressure or memory used to suggest it was swapping and couldn't keep up, which is another reasonable cause.

However, in my case at least deleting all the "Derived Data" made the problem go away. I didn't even have to quit Xcode!

This is simple to do (provided here for anyone who might possibly not know):

  1. From Xcode's Window menu select Projects.
  2. Make sure the project highlighted on the left is your project (or click on your project to make it so)
  3. Click on the Delete... button next to "Derived Data".
like image 34
Howard Cohen Avatar answered Nov 09 '22 06:11

Howard Cohen