如何修复上下文闭包类型 '((String, JSON), (String, JSON)) -> Bool' 需要 2 个参数,但在闭包主体中使用了 1 个?
How to fix Contextual closure type '((String, JSON), (String, JSON)) -> Bool' expects 2 arguments, but 1 was used in closure body?
我正在将我的代码从 swift 3.2 转换为 swift 4,我收到此代码的错误
self.arrData = json.sorted{ [=12=].0.1["chkincount"].doubleValue > [=12=].1.1["chkincount"].doubleValue }.map { [=12=].1 }
Contextual closure type '((String, JSON), (String, JSON)) -> Bool' expects 2 arguments, but 1 was used in closure body
如何解决这个问题?
In sorted closure changed [=11=].0.1
with [=12=].1
to access first closure argument and [=13=].1.1
with .1
to access second closure argument after machine this changes you all set to去吧。
self.arrData = json.sorted{ [=10=].1["chkincount"].doubleValue > .1["chkincount"].doubleValue }.map { [=10=].1 }
我正在将我的代码从 swift 3.2 转换为 swift 4,我收到此代码的错误
self.arrData = json.sorted{ [=12=].0.1["chkincount"].doubleValue > [=12=].1.1["chkincount"].doubleValue }.map { [=12=].1 }
Contextual closure type '((String, JSON), (String, JSON)) -> Bool' expects 2 arguments, but 1 was used in closure body
如何解决这个问题?
In sorted closure changed [=11=].0.1
with [=12=].1
to access first closure argument and [=13=].1.1
with .1
to access second closure argument after machine this changes you all set to去吧。
self.arrData = json.sorted{ [=10=].1["chkincount"].doubleValue > .1["chkincount"].doubleValue }.map { [=10=].1 }