You're updating the datastring variable in a closure. That's code that is passed to Alamofire to be executed later (microseconds later perhaps). So the line assigning datastring to the textView happens first, before the closure executes.