It’s been a while I’ve updated my posts. Here are some new tips that makes coding with swift cool.
@autoclosure
@autoclosure attribute defines an argument that automatically gets wrapped in a closure. It’s used to defer the execution of an expression to the site of use, rather than when the argument is passed.
Example:
func evaluate(array: [String], emptyValue: @autoclosure () -> String) {
	if array.size > 0 {
		print("array size \(array.size)")
	} else {
		print(emptyValue())
	}
}
evaluate(["one", "two", "three"], "emptyArray") // array size 3
evaluate([], "blank") // blank