Skip to content

Instantly share code, notes, and snippets.

@michaelbiggs
Created February 11, 2023 16:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelbiggs/32ac321f444e888d9bac4200cdf40b74 to your computer and use it in GitHub Desktop.
Save michaelbiggs/32ac321f444e888d9bac4200cdf40b74 to your computer and use it in GitHub Desktop.
Swift Closure Syntax
import UIKit
func createView(_ closure: () -> Void) -> UIView {
closure()
return UIView()
}
let exampleClosure: () -> Void = { print("Hello, World!") }
let exampleView = createView(exampleClosure)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment