-
Notifications
You must be signed in to change notification settings - Fork 0
/
TabBarView.swift
100 lines (83 loc) · 2.7 KB
/
TabBarView.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
//
// TabBarView.swift
// Movies&Shows
//
// Created by exo on 21.06.2024.
//
import SwiftUI
import AxisTabView
struct Title: View {
let header: String
let footer: String
var body: some View {
Text(header)
.bold()
.font(.title2)
.foregroundStyle(.text)
.multilineTextAlignment(.leading)
.padding(.bottom)
Text(footer)
.bold()
.font(.callout)
.foregroundStyle(.text)
.multilineTextAlignment(.leading)
}
}
struct Tab : View {
@State var text: String
@State var select: Bool
var body: some View {
VStack (spacing: select ? 0 : -10) {
Image(text + (select ? "-select" : "-normal"))
.resizable()
.renderingMode(.template)
.frame(width: 25, height: 25)
.foregroundColor(select ? .white : .inactive)
.padding(20)
.background(select ? .inactive : .clear)
.clipShape(Circle())
.padding(.top, select ? 0 : 20)
Text(select ? "\n\n" : text)
.font(.caption)
.foregroundColor(Color(.inactive))
}
}
}
struct TabBarView: View {
@State private var selection: Int = 0
@State private var constant = ATConstant(axisMode: .bottom, screen: .init(activeSafeArea: false), tab: .init())
var body: some View {
AxisTabView(selection: $selection, constant: constant) { state in
ATCurveStyle(state, color: .text, radius: 90, depth: 0.9)
} content: {
Text("Find screen")
.tabItem(tag: 0, normal: {
Tab(text: "Find", select: false)
}, select: {
Tab(text: "Find", select: true)
})
Text("Favorites screen")
.tabItem(tag: 1, normal: {
Tab(text: "Favorites", select: false)
}, select: {
Tab(text: "Favorites", select: true)
})
Text("Home screen")
.tabItem(tag: 2, normal: {
Tab(text: "Home", select: false)
}, select: {
Tab(text: "Home", select: true)
})
Text("Collection screen")
.tabItem(tag: 3, normal: {
Tab(text: "Collection", select: false)
}, select: {
Tab(text: "Collection", select: true)
})
}
onTapReceive: { selectionTap in }
}
}
#Preview {
TabBarView()
}