Skip to content

Instantly share code, notes, and snippets.

@codedeman
Created September 12, 2022 01:39
Show Gist options
  • Save codedeman/ef21859f5bc7c368cc796498329f0280 to your computer and use it in GitHub Desktop.
Save codedeman/ef21859f5bc7c368cc796498329f0280 to your computer and use it in GitHub Desktop.
MovieServiceApi
import Foundation
import Alamofire
class MoviveService {
static let instance = MoviveService()
func getListMovie(completion:@escaping(_ sucess:Bool, _ film:FilmData?)->Void) {
let url = "https://codedeman.github.io/ssd_api/fakeCinema.json"
AF.request(url).validate().responseJSON { response in
print("response +++++ --- \(response.result)")
do {
if let data = response.data {
let project = try JSONDecoder().decode(FilmData.self, from: data)
completion(true,project)
}
} catch {
completion(false,nil)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment