Closures

what is a closure ?

  • simply closure is a variable that hold code.
  • like other variables it's hold line of swift codes

Declaring a closure

var selectedItems: ()-> Void = {
}
  • in keyword is used as the separator between parameters and code block.