Created
September 12, 2022 01:39
-
-
Save codedeman/ef21859f5bc7c368cc796498329f0280 to your computer and use it in GitHub Desktop.
MovieServiceApi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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