I have encountered a situation where xcode stops auto-completing and if you try to write a variable that already been defined xcode says << error type>>
<< error type>>
Found out that the error goes away and autocomplete works again if i initialised the variable like this:
var name: String = "my name"
instead of :
var name = "my name" as String