这是一个人为的问题,因为我想更详细地了解swift。 swift 编译器提示以下内容并不详尽。当然,在一般情况下,不能确定案例陈述是否详尽无遗。我应该如何最好 告诉编译器我的列表是详尽无遗的,例如在以下情况中?
let point = (2, 2)
switch point {
case let (x, y) where x == y:
println("on the x=y line")
case let (x, y) where x != y:
println("somewhere else off x=y line")
}
是添加空 default: cases 的唯一选项吗?
最佳答案
Is the only option to add empty default: cases?
在这一点上,是的。这是我们目前必须解决的编译器错误。如果我是你,我一定会file a Radar详细说明您的发现。
关于Swift 无法确定 switch 子句是否详尽无遗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24591016/