Swift错误或此Struct的错误

时间:2015-01-27 17:59:48

标签: xcode swift struct

我从swift开始,但总是出现错误

我做了这个结构:

 struct Needs {
    var name:String
    var qts:Double
}

并制作了一个阵列:

let qq =   [ Needs(  name: "rice",  qts: 3.0 ) ,
             Needs(  name: "shoes",   qts: 1.0 )  ,
             Needs(  name: "water",   qts: 1.0 )  ]

但结果是错误的:

([PEScenatic.Needs]) $R0 = 3 values {
  [0] = (name = "", qts = 0)
  [1] = (name = Swift.String @ 0x7ff9dd903db0, qts = 0)
  [2] = (name = Swift.String @ 0x7ff9dd982390, qts = 0)
}

编辑:在32位模式下真的是一个错误,但在64位iOS模拟器中就是一切正常

0 个答案:

没有答案