-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContentView.swift
76 lines (68 loc) · 3.1 KB
/
ContentView.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
//
// ContentView.swift
// manga_vault
//
// Created by Benjie Tigley on 9/17/24.
//
import SwiftUI
struct ContentView: View {
// List of Manga objects, each containing the title, image name, and URL
@State var readingList = [
Manga(title: "Solo Max-Level Newbie", imageName: "smln", url: "https://asuracomic.net/series/solo-max-level-newbie-55c30889/chapter/1"),
Manga(title: "Omniscient Reader’s Viewpoint", imageName: "orv", url: "https://example.com/omniscient-readers-viewpoint"),
Manga(title: "Martial God Regressed to Level 2", imageName: "mgrl", url: "https://example.com/martial-god-regressed"),
Manga(title: "Weapon Maker", imageName: "wm", url: "https://example.com/weapon-maker"),
Manga(title: "Swordmaster’s Youngest Son", imageName: "sys", url: "https://example.com/swordmasters-youngest-son"),
Manga(title: "Boundless Necromancer", imageName: "bn", url: "https://example.com/boundless-necromancer"),
Manga(title: "Player Who Returned 10,000 Years Later", imageName: "pwr", url: "https://example.com/player-returned"),
Manga(title: "I Killed an Academy Player", imageName: "ikap", url: "https://example.com/i-killed-an-academy-player")
]
@State private var showingAddNew = false
var body: some View {
NavigationView {
ZStack {
List(readingList) { manga in
NavigationLink(destination: ReadingView(mangaTitle: manga.title, mangaURL: manga.url)) {
HStack {
Image(manga.imageName)
.resizable()
.frame(width: 40, height: 40)
.clipShape(RoundedRectangle(cornerRadius: 8))
.padding(.trailing, 10)
Text(manga.title)
.font(.headline)
}
}
}
.navigationTitle("Library")
VStack {
Spacer()
HStack {
Spacer()
Button(action: {
showingAddNew = true
}) {
Image(systemName: "plus")
.font(.system(size: 24))
.frame(width: 60, height: 60)
.foregroundColor(.white)
.background(Color.blue)
.clipShape(Circle())
.shadow(color: .gray, radius: 4, x: 2, y: 2)
}
.padding(.trailing, 20)
.padding(.bottom, 20)
}
}
}
.sheet(isPresented: $showingAddNew) {
AddNewView(readingList: $readingList)
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}