My app creates dynamic copies of UI controls that are based on a custom UIButton subclass using this legacy approach:
let archivedButton = try NSKeyedArchiver.archivedData(withRootObject: self, requiringSecureCoding: false)
guard let buttonDuplicate = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(archivedButton) as? UIWagerButton else {return nil }
I am currently trying to work passed the deprecation of
NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data: Data)
Per the guidance, I should be replacing that line with the following and ensuring that the custom class implements NSSecureCoding
guard let buttonDuplicate = try NSKeyedUnarchiver.unarchivedObject(ofClass: UIWagerButton.self, from: archivedButton) else {return nil}
However, while the code does compile and run, decoding the data reference throws the following error:
value for key 'UIButtonStatefulContent' was of unexpected class 'NSMutableDictionary'
I can only assume that if I get passed this specific property, there will be other properties that are also problematic.
Question: Is this a bug? Or, am I now responsible for navigating the underlying property matrix of this UIControl to specifically, manually, handle the encoding and decoding of each of it's properties?