Swift 2.0 version of struct GeneratorOf<T>

余生颓废 提交于 2019-12-12 11:24:14

问题


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

Thanks


回答1:


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) */ }



回答2:


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



来源:https://stackoverflow.com/questions/32255249/swift-2-0-version-of-struct-generatoroft

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!