-
Notifications
You must be signed in to change notification settings - Fork 0
/
MovieDetailsViewController.swift
58 lines (38 loc) · 1.56 KB
/
MovieDetailsViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// MovieDetailsViewController.swift
// flixster
//
// Created by Angie Thielk on 2/22/21.
//
import UIKit
import AlamofireImage
class MovieDetailsViewController: UIViewController {
@IBOutlet weak var backdropView: UIImageView!
@IBOutlet weak var posterView: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var synopsisLabel: UILabel!
var movie: [String:Any]!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
titleLabel.text = movie["title"] as? String
titleLabel.sizeToFit()
synopsisLabel.text = movie["overview"] as? String
synopsisLabel.sizeToFit()
let baseUrl = "https://image.tmdb.org/t/p/w185"
let posterPath = movie["poster_path"] as! String
let posterUrl = URL(string: baseUrl + posterPath)
posterView.af.setImage(withURL: posterUrl!)
let backdropPath = movie["backdrop_path"] as! String
let backdropUrl = URL(string: "https://image.tmdb.org/t/p/w780" + backdropPath)
backdropView.af.setImage(withURL: backdropUrl!)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}