Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

swift pass any closer to the function

func anyFunc<T>(_ closure: @autoclosure () -> T) {
  let result: T = closure()
  // TODO: Do something with result?
}

anyFunc(print("hello"))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #swift #pass #closer #function
ADD COMMENT
Topic
Name
4+1 =