API.swift extract: gets data from Nasa API using APIKEY supplied by them.
import Foundation
classAPI{classfunc getImage(_ onSuccess:@escaping([LatestPhoto])->()){Constrant.session.dataTask(with:Constrant.request){(data, res, err)in
guard let data = data, err ==nilelse{fatalError()}do{letapod=tryJSONDecoder().decode(LatestPhotosWrapper.self, from: data)DispatchQueue.main.async{onSuccess(apod.latestPhotos)}}catch{print(error)}}.resume()}}
🆒 Features
If you want to save any of the images to your iphone photo library you can do so by holding down on the image for two seconds. Then
you will be asked for permission to access your photos and the image will be saved.
📁 License
This project is licensed under the terms of the MIT license.