I\'m learning Swift lang, but I cannot pass optional callback argument into function:
func dismiss(completion: () -> Void) {
if (completion) {
ret
Just adding to Martin R's answer above..
The callback can be optional, instead of implicit parameter (with exclamation mark), use the optional operator.
func dismiss(completion: (() -> Void)?) {
if completion != nil {
return self.dismissViewControllerAnimated(true, completion: completion!)
}
self.dismissModalViewControllerAnimated(true)
}