[英]Xcode6 swift type inference bug?
通过添加以下代码的任何视图控制器:
Xcode6将停止工作。
无法编译和运行。
是xcode问题吗?
let popularTableData = [
[
"id": 1,
"title": "xxx"
],
[
"id": 2,
"title": "xxx"
],
[
"id": 3,
"title": "xxx"
],
[
"id": 4,
"title": "xxx"
],
[
"id": 5,
"title": "xxx"
],
[
"id": 6,
"title": "xxx"
],
[
"id": 7,
"title": "xxx"
]
]
是的,这是一个错误。 在这种情况下,Swift编译器在确定popularTableData
的类型时popularTableData
问题。 通过明确声明类型来为其提供帮助:
let popularTableData: [[String: AnyObject]] = [
我将您的代码放在一个Playground中,并且最终成功了(一分钟后)。 随着每个额外的字典元素添加到数组中,编译时间似乎成倍增加。 当您告诉编译器类型时,它会快速编译。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.