-
Notifications
You must be signed in to change notification settings - Fork 0
/
CharacterView.swift
42 lines (37 loc) · 1.06 KB
/
CharacterView.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
//
// CharacterView.swift
// BerserkShot
//
// Created by Joe Zoll on 10/3/23.
//
import SwiftUI
struct CharacterView: View {
let character: Character
var body: some View {
ScrollView {
VStack {
Image(character.image_url)
.resizable()
.scaledToFill()
.background(
RadialGradient(colors: [.gray, .black], center: .center, startRadius: 80, endRadius: 290)
)
Text(character.description)
.padding()
.fontWeight(Font.Weight.light)
}
}
.background(
.black
)
.navigationTitle(character.name)
.navigationBarTitleDisplayMode(.inline)
}
}
struct CharacterView_Previews: PreviewProvider {
static var characters: [Character] = Bundle.main.decode("characters.json")
static var previews: some View {
CharacterView(character: characters[0])
.preferredColorScheme(.dark)
}
}