Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

Autoclosure Swift

// define a function with automatic closure
func display(greet: @autoclosure () -> ()) {
 greet()
}

// pass closure without {}
display(greet: print("Hello World!"))
 
PREVIOUS NEXT
Tagged: #Autoclosure #Swift
ADD COMMENT
Topic
Name
7+9 =