我正在使用 Swift 2。
我使用了这段代码:
while contains(currentCardValues, randomNumber + 1) {
我收到此错误:
"contains" is unavailable: call the contains() method on the sequence
最佳答案
这是因为 contains()
方法在 Sequence
的协议(protocol)扩展中定义.
所以你应该这样称呼它:
currentCardValues.contains(randomNumber + 1)
关于swift2 - 不能在 Swift 2 中使用方法 "contains",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30839733/