Unofficial APOD utilizes Alamofire
to request data from NASA's APOD servers. The response data is returned in JSON format. Unofficial APOD utilizes structs conforming to Swift's Codable
protocol to parse the JSON returns and persists the data in Core Data. Prior to requesting information from NASA's servers, Unofficial APOD first checks to see if it has already retrieved the data before making a network request.
NASA returns a JSON with text data about the image, but no binary data is returned. Unofficial APOD utilizes AlamofireImage
to download the most recent 60 days' worth of non-copywritten images on a background thread and persists them locally to speed up performance for the user.
Copywritten images are not stored on the device. So the user doesn't see an empty screen, the UICircularProgressRing
framework is configured to display the status of the image download.
Given the size of images downloaded by the app can sometimes be quite large, it is recommended users do the initial data download on a fast, non-cellular connection. The last 60 days of non-copywritten images are saved locally on the device, as are images marked as favorites.
Unofficial APOD utilizes a UISplitViewController
to display data. Future versions may be refactored to display the data as a UICollectionView
. Core Data is used to persist text data retrieved from NASA's servers, while FileManager
is used to persist image data locally on the user's device (non-copywritten images only).
The master view controller and the detail view controller only perform tasks related to displaying images on the screen. A data manager class handles asynchronous network requests and saving new data to Core Data. Updating of the UITableView is accomplished via Notifications
from Core Data.
Unofficial APOD also contains a picture utility, which handles asynchronous downloading of image data annd bookkeeping related to maintaining the last 60 days worth of images as well as storage and deletion of favorites.
NASA’s Astronomy Picture of the Day (APOD) API gives developers access to APOD imagery and relevant metadata.
Utilized for network requests.
AlamofireImage works in the background to download the most recent 60 days of non-copywritten images and persists them in the app. Additionally, non-copywritten images that are marked as Favorites are also stored on the device.
Utilized for retrieving images asynchronously. Kingfisher is used to asynchronously display thumbnail images and cache them locally forr better performance.
Utilized for making date selections on a calendar.
Utilized to update the status of image downloads.
Utilized for extracting the primary color of the image downloaded from NASA to determine the text color that is displayed.
This does not appear often within the app, but it's a nice, simple framework that deals with empty data sets.