Stats

661 Contributors: 10 Saturday, November 26, 2016
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap
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