-
Notifications
You must be signed in to change notification settings - Fork 1
/
DetailView.swift
71 lines (62 loc) · 2.18 KB
/
DetailView.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
//
// DetailView.swift
// MovieBook
//
// Created by Mehmet Ateş on 1.10.2021.
//
import SwiftUI
struct DetailView: View {
var imdbId : String
@ObservedObject var filmdetay = FilmDetayViewModel()
var screenSize = UIScreen.main.bounds
var body: some View {
ScrollView{
HStack() {
Text(filmdetay.filmDetayi?.title ?? "name")
.font(.largeTitle)
.bold()
Spacer()
}
.padding(.leading)
CustomImage(url: filmdetay.filmDetayi?.poster ?? "")
.frame(
width: screenSize.width * 0.9, height: screenSize.width * 1.3, alignment: .center)
.cornerRadius(25.0)
.shadow(radius: 20)
VStack(alignment:.leading) {
Section {
Text("About Movie")
Text(filmdetay.filmDetayi?.plot ?? "Film kanka")
.lineLimit(4)
.foregroundColor(.accentColor)
.padding(.bottom)
}
Section {
Text("Date: ")
Text(filmdetay.filmDetayi?.realesed ?? "Tarih")
.foregroundColor(.gray)
.padding(.bottom)
}
Section{
Text("Awards: ")
Text(filmdetay.filmDetayi?.awards ?? "Ödüller")
.foregroundColor(.orange)
.padding(.bottom)
}
Section{
Text("IMDB Rating: ")
Text(filmdetay.filmDetayi?.imdbRating ?? "imdbScore")
.foregroundColor(Double(filmdetay.filmDetayi?.imdbRating ?? "") ?? 0 > 6 ? .green : .red)
.padding(.bottom)
}
}.padding()
}.onAppear {
self.filmdetay.filmDetayiAl(imdbId: imdbId)
}
}
}
struct DetailView_Previews: PreviewProvider {
static var previews: some View {
DetailView(imdbId: "tt0120338")
}
}