Swift snippet #5 β Generic Typealias
Published in
1 min readDec 2, 2016
Friday, 2nd December, 2016
In Swift 3 now that we can have generic typealiases
, I use the above snippet quite often which declares a closure of a generic type (which could be any object you want) with void return type. We can use it in the following way which make things quite readable and easy to use π:
let intClosure: Closure<Int> = { intValue in
...
}intClosure(10)
If you are wondering about the inception of Swift-Snippets or want to checkout more such snippets then you can find them here π