Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift 2.0 version of struct GeneratorOf<T>

It appears that struct GeneratorOf<T> {…} is not available in in Swift 2.0. Does anyone know what, if anything, replaces this struct?

Thanks

like image 954
Rob Avatar asked Aug 27 '15 16:08

Rob


2 Answers

GeneratorOf was replaced by AnyGenerator but you have to call a global function instead of the initializer to make one:

anyGenerator(anotherGenerator)
anyGenerator{ /* pass "next function" (as closure) */ }
like image 133
Qbyte Avatar answered Nov 15 '22 10:11

Qbyte


In Swift 2 GeneratorOf is replaced by class AnyGenerator<Element>.

like image 41
Mario Zannone Avatar answered Nov 15 '22 10:11

Mario Zannone