[英]Swift 3.0 array “contains” argument compiler error
Here is the statement that's causing trouble. 这是引起麻烦的声明。 This worked perfectly in Swift 2.2 but is not working in 3.0 and Xcode 8.
这在Swift 2.2中工作得很好,但在3.0和Xcode 8中却不起作用。
keys = keys
.enumerated()
.filter { !indexesToRemove.contains($0.index) }
.map { $0.element }
Right at $0.index
xCode is throwing a compiler error: 就在
$0.index
抛出编译器错误:
Value of tuple type '(offset: Int, element: Any)' has no member 'index'
As far as I know $0 represents objects in the keys
array. 据我所知,$ 0代表
keys
数组中的对象。 What tuple is it talking about? 它在说什么元组?
index
has been changed to offset
in Swift 3 (don't ask me why): index
已在Swift 3中更改为offset
(不要问我为什么):
keys = keys
.enumerated()
.filter { !indexesToRemove.contains($0.offset) }
.map { $0.element }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.