【发布时间】:2016-05-26 09:21:29
【问题描述】:
我正在尝试从 Swift 类创建一个 CGRect 数组,最终将发送到 Objective C 类。
据我了解,Objective C 在创建 CGRect 数组时期待 NSArray 或 NSMutableArray。我尝试创建一个NSArray 并附加CGRect,但它会打印错误:
Cannot convert value of type 'NSValue' to expected argument type 'NSArray'
Swift 代码:
var rects = [NSArray]()
let v = NSValue(CGRect: feature.bounds)
rects.append(v)
大家有什么建议吗?
【问题讨论】:
标签: objective-c swift nsarray cgrect