【发布时间】:2017-02-22 20:55:39
【问题描述】:
我目前正在使用此代码从 plist 中读取数组
let filePath = Bundle.main.path(forResource: "levelList", ofType: "plist")
if let path = filePath {
devices = NSArray(contentsOfFile: path) as! [AnyObject]
}
let device1 = devices[0] as! [String: AnyObject]
let device2 = devices[1] as! [String: AnyObject]
如果我在读取文件之前知道我只对设备 1 感兴趣,有没有办法选择性地只读取数组的那一部分?
【问题讨论】:
-
你的意思是,只读取文件的那一部分?
-
你能详细说明你想要什么吗?