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