My very simple program is looping through an array to export several files. While it's in the loop, I'd like it to update a text field to tell the user which file is currently exporting. Code looks like this:
for item in filesArray {
var fileName = item["fileName"]
fileNameExportLabel.stringValue = "Exporting \(fileName).ext"
println("Exporting \(fileName).ext")
//--code to save the stuff goes here--
}
What happens is: println
works correctly, throwing out a message for each file, but the label called fileNameExportLabel
is only updated when the last file has been exported, so it's blank during the whole loop and gets the last file name once the loop reaches the end.
Any Idea? I'm a total noob here, I'm wondering if the NSTextField needs a command to be updated, similarly to a table view.
Thanks in advance!