The structure stores the date value in the Date? format, but after saving it returns it in the timestamp format.
if let data = try? JSONEncoder().encode(contact),
let dict = try? JSONSerialization.jsonObject(with: data, options: .Element.fragmentsAllowed) {
defaults.set(
dict,
forKey: "contact")
}
print(defaults.object(forKey: "contact"))
}
Please tell me how can I save the date in Date format. In this case, it is necessary to preserve the entire structure.