Reputation: 3
When calling getItems function, XCode auto completes to:
getItems(success: (([File]) -> ())?, fail: ((Error) -> ())?)
I just need some assistance understanding what I need to input in order to get the list of items.
I've created simple callbacks and read up on Apple's closure documentation to better understand what's going on but am still a little confused by this in particular.
Upvotes: 0
Views: 51
Reputation: 1504
You'll have to put closure
s as parameters like below to use this function:
getItems(success: { (files) in
// files: [File]
for file in files {
print(file)
}
}, fail: { (error) in
// error: Error
print(error)
})
Upvotes: 1