I want to save an array of object in user default without using Codable.
I tried it to convert an array in data and save in User default:
let childsArray = result["childs"] as? [[String: Any]]
let childsData = NSKeyedArchiver.archivedData(withRootObject: childsArray!)
UserDefaults.standard.set(childsData, forKey: "childsArray")
UserDefaults.standard.synchronize()
It gives me this warning:
'archivedData(withRootObject:)' was deprecated in iOS 12.0: Use +archivedDataWithRootObject:requiringSecureCoding:error: instead
How do I resolve this warning and achieve my desired goal of saving an array of objects in UserDefaults?