PipesNotTearsSwift 数组扩展包
PipesNotTears 是 Swift 的数组扩展包。
[4,2,3,3,3,3,1] | sorted | unique | reverse | chunk(2) //=> [[4,3], [2,1]] [1,5,2,4,3] | sorted | suffix(2) //=> [4,5] if any([1,2,3] | shuffle | prefix(2), { $0 > 2 }) { println(":)") } ["key1": 1] + ["key2": 2] //=> ["key1": 1, "key2": 2]
评论