您的位置:首页 > 移动开发 > Swift

ios swift generator 文章推荐

2015-09-22 10:43 435 查看
https://medium.com/swift-programming/sequence-beyond-primitive-iterations-in-swift-80bc2507d8cc

/// Return a `GeneratorType` instance whose `next` method invokes
/// `body` and returns the result.
///
/// Example:
///
///     var x = 7
///     let g = anyGenerator { x < 15 ? x++ : nil }
///     let a = Array(g) // [ 7, 8, 9, 10, 11, 12, 13, 14 ]
@warn_unused_result
public func anyGenerator<Element>(body: () -> Element?) -> AnyGenerator<Element>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: