i'm new swift, , i'm trying declare function receives callback.
func getall(callback: (students: [student]!) -> void) { // http request list of students , parse callback(students: students) }
and when calling function, i'm doing:
obj.getall() { (students: [student]!) in // callback code }
but won't build, says: cannot invoke getall argument list of type '(([student]!) -> _)'
i following this thread guide, did miss?
struct student { } func getall(callback: (students: [student]!) -> void) { // http request list of students , parse let students = [student]() callback(students: students) } getall { (students) -> void in println(students) }