我想比较两个数组的元素并检查它们是否相等。我已经尝试了各种解决方案,但都没有成功。
我尝试了来自如何比较两个对象数组?的解决方案。
这是我的对象:
这是我尝试的链接中的代码:
但是我遇到了这个错误:
我尝试了来自如何比较两个对象数组?的解决方案。
这是我的对象:
struct AccountBalance: Decodable {
let balance: Double
let currency: String
init(balance: Double, currency: String ) {
self.currency = currency
self.balance = balance
}
enum CodingKeys: String, CodingKey {
case currency = "Currency"
case balance = "Balance"
}
}
这是我尝试的链接中的代码:
这是我尝试的链接中的代码:
let result = zip(accountBalance, getsSaved).enumerate().filter() {
$1.0 == $1.1
}.map{$0.0}
但是我遇到了这个错误:
Closure tuple parameter '(offset: Int, element: (AccountBalance, AccountBalance))' does not support destructuring with implicit parameters