Declare a Closure in Swift

In this short Swift code example we will learn how to declare a simple Closure in Swift.

  • Declare a Closure
  • Call Closure
  
 
// Declare a closure
let simpleClosure = {
    print("From a simpleClosure")
}

// Call closure
simpleClosure()       
 

[raw_html_snippet id=”cookbookpagecoursesheader”]

Unit Testing Swift Mobile App

Apply Test-Driven Development(TDD) process to iOS mobile app development in Swift Preview this video course.