indexmay not be recognized by the compiler. Try the code on the playground:
import UIKit
let index = 3
var path = NSIndexPath(forRow: index, inSection: 0)
Job
import UIKit
var path = NSIndexPath(forRow: index, inSection: 0)
Error: Extra Argument 'inSection' in call
This means that your variable is indexnot defined. Or you should try Cleanand remove the derived data.
:
index dispatch_async, index.
dispatch_async(dispatch_get_main_queue(), { _ in
println("reloadRow row=" + String(index) + ",inSection:0");
var path = NSIndexPath(forRow: index, inSection:0);
self.tableView.reloadRowsAtIndexPaths([path], withRowAnimation: UITableViewRowAnimation.Automatic);
});
: Swift . ( + ):
dispatch_async(dispatch_get_main_queue()) {
println("reloadRow row=" + String(index) + ",inSection:0");
var path = NSIndexPath(forRow: index, inSection:0);
self.tableView.reloadRowsAtIndexPaths([path], withRowAnimation: UITableViewRowAnimation.Automatic);
}
: . dispatch_async, { index in, , . ( ). .
var index = 0
for (key, value) in map! {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
dispatch_async(dispatch_get_main_queue()) {
println("reloadRow row=" + String(index) + ",inSection:0");
var path = NSIndexPath(forRow: index, inSection:0);
self.tableView.reloadRowsAtIndexPaths([path], withRowAnimation: UITableViewRowAnimation.Automatic);
}
}
index++
}