Stats

661 Contributors: 10
2016-11-26
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook

Closures

Download swift eBook

Syntax

  • var closureVar: (<parameters>) -> (<returnType>) // As a variable or property type
  • typealias ClosureType = (<parameters>) -> (<returnType>)
  • { [<captureList>] (<parameters>) <throws-ness> -> <returnType> in <statements> } // Complete closure syntax

Remarks

For more information on Swift closures, see Apple's documentation.

Related Examples