本文介绍了Swift 2.0版本的结构GeneratorOf< T>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
看来 struct GeneratorOf< T>在Swift 2.0中{...}
不可用。有人知道什么,如果有的话,将取代这个结构? 谢谢
解决方案
GeneratorOf
被 AnyGenerator
取代,但是您必须调用全局函数而不是初始化器来创建一个:
anyGenerator(anotherGenerator)
anyGenerator {/ *传递next function(as closure)* /}
It appears that struct GeneratorOf<T> {…}
is not available in in Swift 2.0. Does anyone know what, if anything, replaces this struct?
Thanks
解决方案
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) */ }
这篇关于Swift 2.0版本的结构GeneratorOf< T>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!