Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func loadFilms() {
- let id = filmId
- let apiKey = "97a0d64910120cbeae9df9cb675ad235"
- let url = URL(string: "https://api.themoviedb.org/3/movie/(id)?api_key=(apiKey)&language=en-US")
- let request = URLRequest(
- url: url! as URL,
- cachePolicy: URLRequest.CachePolicy.reloadIgnoringLocalCacheData,
- timeoutInterval: 10 )
- let session = URLSession (
- configuration: URLSessionConfiguration.default,
- delegate: nil,
- delegateQueue: OperationQueue.main
- )
- let task = session.dataTask(with: request, completionHandler: { (dataOrNil, response, error) in
- if let data = dataOrNil {
- do { let details = try! JSONDecoder().decode(Details.self, from: data)
- }
- }
- })
- task.resume()
- }
Add Comment
Please, Sign In to add comment