I need to encode and decode Array<Array<SomeStruct>>
SomeStruct is multiplexed in an Int
The former API did work:
if let format = decoder.decodeObject(forKey: someKey) as? Array<Array<SomeStruct>> { }
But using the new API
if let format = decoder.decodeObject(of: Array<Array<Int>>.self, forKey: someKey) {
generates an error:
Cannot convert value of type 'Array<Array<Int>>.Type' to expected argument type '[AnyClass]' (aka 'Array<any AnyObject.Type>')
encoding is done as follows:
var format = Array(repeating: Array(repeating: 0, count: 4), count: 4)
// initialize the var
coder.encode(format, forKey: someKey)
What is the correct syntax ?