Encoding Swift Array

172 views Asked by At

I am attempting to store a Swift array in encodeRestorableStateWithCoder but I am getting the error:

Cannot convert value of type '[Int?]' to expected argument type 'AnyObject?'

How can I store the array? Do I have to convert it to an NSArray?

public var imageViewsImageVersion: [Int?] = []

override public func encodeRestorableStateWithCoder(coder: NSCoder) {
    coder.encodeObject(imageViewsImageVersion, forKey: "imageViewsImageVersion")
} 
0

There are 0 answers