Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在将我的代码从 swift 3.2 转换为 swift 4,我收到此代码的错误
self.arrData = json.sorted{ $0.0.1["chkincount"].doubleValue > $0.1.1["chkincount"].doubleValue }.map { $0.1 }
上下文闭包类型 '((String, JSON), (String, JSON)) -> Bool' 需要 2 个参数,但 1 在闭包主体中使用
如何解决这个问题?
在排序的闭包中更改$0.0.1为$0.1访问第一个闭包参数,并$0.1.1在进行$1.1此更改后访问第二个闭包参数,您都准备好了。
$0.0.1
$0.1
$0.1.1
$1.1
self.arrData = json.sorted{ $0.1["chkincount"].doubleValue > $1.1["chkincount"].doubleValue }.map { $0.1 }