环境:Swift,Xcode 6
如何获取Swift数组的数据项列表(po)?
以下是构建简单数组的Swift代码:
kindArray += "Two" kindArray.append("Two") var myStringArray: String[] myStringArray = ["One","Two"] myStringArray.append("Three") myStringArray += "Four" var firstItem = myStringArray[0]
这里是调试输出:
(lldb) po firstItem "One" (lldb) po kindArray Some { Some = 0x0ffb0000 {} } (lldb) po myStringArray size=1 { [0] = { core = { _baseAddress = Builtin.RawPointer = 0x00000008 _countAndFlags = 34718 _owner = Some { Some = (instance_type = Builtin.RawPointer = 0x80000003) } } } }
做就是了:
原文链接:https://www.f2er.com/swift/320827.htmlpo print(myStringArray)