have this SpaceX API that I have to call but idk how set this date like a normal date and display it on a tableview
This looks like it’s from a JSON response to an API call, so the easiest way to do it is something like this:
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .iso8601
This will turn the "date_local"
string value into a Swift Date
when you decode the JSON. You can then use a DateFormatter
to display it in whatever format you desire.
1 Like