An example JSON feed demo written in Swift 4 using Codable on a USGS GeoJSON data feed.
The interesting bits are:
USGSEarthquakeData
in USGSEarthquakeData.swift - Nested struct uses Codable without requiring any customizationfetch()
in USGSEarthquakeData.swift - Fetches the data from the USGS web siteviewDidLoad()
in MasterViewController.swift - Triggers the fetch
I developed this demo while writing these medium.com articles: