The goal:
I want to have a computed property which returns an array with different type of objects based on NSMutableArray and swift array combination.
Two problem here:
- Computed property contains code with an
NSMutableArray - I don't know how to combine two arrays.
NSMutableArray+[AnyObjct]
I have an Objective-C class CentralManager with a method storedDevices that returns NSMutableArray with some objects. Example:
var wifiDevices = [WifiDevice]()
var allDevices: NSMutableArray {
get {
let blueToothDevices = CentralManager.shared().storedDevices
let devices = blueToothDevices + wifiDevices // it does not work as we can't combine NSMutableArray and swift array.
return devices
}
}
Also as I use swift not sure that my computed property should return NSMutableArray, maybe it's better to return [AnyObject]