So far we’ve just been hitting the API anytime we need to display some day. Let’s create a Core Data model that will let us cache the JSON payload.
Problem
We’re hitting the API every time we need some data.
Steps
- Create a new file of type Data Model
- Add an Entity named NASA
- Add an attribute for each property from
Pod.swift
- date: Date?
- url: URI?
- hdurl: URI?
- thumbnailUrl: URI?
- title: String?
- copyright: String?
- explanation: String?
- mediaType: String?
- serviceVersion: String?