-1

Every time I typed "for x in variable" (trying to iterate over a textField) I get an error "SourceKitService Terminated"

Does anyone know if this is a known issue? Is there a fix? Thanks!

EDIT:

Code:

for token in expressionTextField.text {
    pf.expression += token

}
Connor Pearson
  • 63,902
  • 28
  • 145
  • 142
Brejuro
  • 3,421
  • 8
  • 34
  • 61
  • 3
    This question should have some actual code. Also, I didn't know text field was a collection that could be iterated over. – nhgrif Jun 28 '14 at 01:38
  • possible duplicate of [SourceKitService Terminated](http://stackoverflow.com/questions/24006206/sourcekitservice-terminated) – Brett Jun 28 '14 at 01:40
  • Added code, my apologies! – Brejuro Jun 28 '14 at 01:42
  • I flagged this as a duplicate. But just so you know, it's basically a harmless crash of the process the does syntax highlighting (and possibly code completion). Happens all the time for me and usually restarts itself. Future releases should fix this and many other problems with the editor. – Brett Jun 28 '14 at 01:43

1 Answers1

1

Make sure that expressionTextField.text is non-nil before iterating through it.

if let str = expressionTextField.text{
    for token in str{
        pf.expression += token
    }
}

That being said, this is also a bug with Xcode's parser that should be fixed by this fall.

Connor Pearson
  • 63,902
  • 28
  • 145
  • 142