-
Notifications
You must be signed in to change notification settings - Fork 1
/
MovieDetail.swift
106 lines (83 loc) · 2.68 KB
/
MovieDetail.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//
// MovieDetail.swift
// BuildNetflixClone
//
// Created by Siddhant Mulajkar on 06/03/21.
//
import SwiftUI
struct MovieDetail: View {
var movie: Movie
let screen = UIScreen.main.bounds
var body: some View {
ZStack {
Color.black
.edgesIgnoringSafeArea(/*@START_MENU_TOKEN@*/.all/*@END_MENU_TOKEN@*/)
VStack {
HStack {
Spacer()
Button(action: {
//close this view
}, label: {
Image(systemName: "xmark.circle")
.font(.system(size: 28))
})
}.padding(.horizontal, 22)
ScrollView(.vertical, showsIndicators: false) {
VStack {
StandardHomeMovie(movie: movie)
.frame(width: screen.width / 2.5)
MovieInfoSubHeadline(movie: movie)
//watch season3 or 2 something like that which appears after the main start buttons
if movie.prmotionHeadline != nil{
Text(movie.prmotionHeadline!)
}
}
}
Spacer()
}
.foregroundColor(.white)
}
}
}
struct MovieDetail_Previews: PreviewProvider {
static var previews: some View {
MovieDetail(movie: exampleMovie4)
}
}
struct MovieInfoSubHeadline: View {
var movie: Movie
var body: some View {
HStack(spacing: 20) {
Image(systemName: "hand.thumbsup.fill")
Text(String(movie.year))
RatingView(rating: movie.rating)
Text(movie.numberOfSeasonsDisplay)
HDButton()
}
.foregroundColor(.gray)
.padding(.vertical, 6)
}
}
struct RatingView: View {
var rating: String
var body: some View {
ZStack {
Rectangle().foregroundColor(.gray)
Text(rating).foregroundColor(.white)
.font(.system(size: 12))
.bold()
}
.frame(width: 60, height: 20)
}
}
struct HDButton: View {
var body: some View {
ZStack {
Rectangle().foregroundColor(.gray)
Text("HD").foregroundColor(.white)
.font(.system(size: 12))
.bold()
}
.frame(width: 30, height: 20)
}
}