标签:font 分享 ram rgb 技术 let cocoa width param
语法:
{ (parameters) ->return type in statements}
实例:採用函数实现:
let names =["Chris", "Alex", "Ewa", "Barry", "Daniella"] funcbackwards(s1: String, s2: String) -> Bool { return s1 > s2 } var reversed = sort(names, backwards) println(reversed) //sort 排序函数,backwards 通过排序规则的函数 採用闭包实现: var reversed = sort(names, { (s1: String, s2: String) -> Bool in return s1 > s2 }) println(reversed)
Swift交流讨论论坛论坛:http://www.cocoagame.net
欢迎增加Swift技术交流群:362298485
标签:font 分享 ram rgb 技术 let cocoa width param
原文地址:http://www.cnblogs.com/wzjhoutai/p/6917321.html