March 26, 2022, 3:56 p.m. | John Kevin Losito

DEV Community dev.to




Closures, passing functions into functions, and checkpoint 5


https://www.hackingwithswift.com/100/swiftui/9





Closures


You can copy functions in Swift, and they work the same as the original except they lose their external parameter names.



func greetUser() {
print("Hi there!")
}

greetUser()

var greetCopy = greetUser
greetCopy()


All functions have types. This includes the parameters they receive along with their return type, which might be Void.



func getUserData(for id: Int) -> String {
if id == 1989 {
return "Taylor Swift"
} else { …

100daysofcode swift swiftui

SOC 2 Manager, Audit and Certification

@ Deloitte | US and CA Multiple Locations

Regional Leader, Cyber Crisis Communications

@ Google | United Kingdom

Regional Intelligence Manager, Compliance, Safety and Risk Management

@ Google | London, UK

Senior Analyst, Endpoint Security

@ Scotiabank | Toronto, ON, CA, M1K5L1

Software Engineer, Security/Privacy, Google Cloud

@ Google | Bengaluru, Karnataka, India

Senior Security Engineer

@ Coinbase | Remote - USA