In this chapter, we parse open and closed events from EONET API. However, even though EOEvent.closeDate
is an optional in the API response, it is being forced in the EOEvent.init
method. Thus, open events never get parsed. To fix this, please change try
in closeDate = try? container.decode(Date.self, forKey: .closeDate)
to try?
.
Hope this helps future learners.