Declare a Closure With Multiple Arguments in Swift

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

  • Declare a Closure with two arguments
  • Call Closure
  
 
//// Declare a Closure
let fullName = { (firstName:String, lastName:String)->String in
    return firstName + " " + lastName
}

// Call Closure
let myFullName = fullName("Sergey", "Kargopolov")
print("My full name is \(myFullName)")

[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.