Skip to content

Commit 75b3d86

Browse files
committed
feature: WuxiaInfoView에서 스크롤로 닫는 기능과 X버튼으로 닫는 기능 ㄷ모두 구현
1 parent 5dd07fa commit 75b3d86

File tree

3 files changed

+48
-33
lines changed

3 files changed

+48
-33
lines changed

WuxiaMeditation/View/SettingView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct SettingView: View {
6565
isShowWuxiaInfo = true
6666
} label: {
6767
HStack(spacing: 24) {
68-
Text("무협인문 武俠入門")
68+
Text("무협입문 武俠入門")
6969
.font(.customTitle3Bold)
7070
Spacer()
7171
Image(systemName: "ipad.and.arrow.forward")
@@ -111,7 +111,7 @@ struct SettingView: View {
111111
}
112112
.padding()
113113
.sheet(isPresented: $isShowWuxiaInfo) {
114-
WuxiaInfoView()
114+
WuxiaInfoView(isShowWuxiaInfo: $isShowWuxiaInfo)
115115
}
116116
.onAppear {
117117
setDateFromUserDefaults()

WuxiaMeditation/View/WuxiaInfoView.swift

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,54 +8,69 @@
88
import SwiftUI
99

1010
struct WuxiaInfoView: View {
11+
@Binding var isShowWuxiaInfo: Bool
1112
var body: some View {
1213
ZStack {
1314
DefaultBackgroundAnimationView()
1415
.ignoresSafeArea()
1516
Color.black.opacity(0.6)
1617
.ignoresSafeArea()
1718
.background(.ultraThinMaterial.opacity(0.4))
18-
ScrollView {
19-
VStack(alignment: .leading, spacing: 80){
19+
VStack {
20+
HStack {
2021
Spacer()
21-
.frame(height: 100)
22-
HStack {
22+
Button {
23+
isShowWuxiaInfo = false
24+
} label: {
25+
Image(systemName: "xmark.circle")
26+
.imageScale(.large)
27+
28+
}
29+
}
30+
.padding()
31+
.foregroundStyle(.white)
32+
ScrollView {
33+
VStack(alignment: .leading, spacing: 80){
2334
Spacer()
24-
VStack(spacing: 24) {
25-
Text("運氣調息")
26-
.font(.system(size: 80))
27-
VStack(alignment: .leading, spacing: 8) {
28-
Text("운기조식(運氣調息)은 기(氣)의 흐름을 조절하고 마음을 다스리는 명상입니다.")
29-
.multilineTextAlignment(.center)
35+
.frame(height: 100)
36+
HStack {
37+
Spacer()
38+
VStack(spacing: 24) {
39+
Text("運氣調息")
40+
.font(.system(size: 80))
41+
VStack(alignment: .leading, spacing: 8) {
42+
Text("운기조식(運氣調息)은 기(氣)의 흐름을 조절하고 마음을 다스리는 명상입니다.")
43+
.multilineTextAlignment(.center)
44+
}
45+
.font(.customBody)
3046
}
31-
.font(.customBody)
47+
Spacer()
3248
}
33-
Spacer()
34-
}
35-
ForEach(WuxiaInfo.dummyInfoList) { info in
36-
VStack(alignment: .leading, spacing: 26) {
37-
Text(info.title)
38-
.font(.customTitle3Bold)
39-
ForEach(info.infoList) { subInfo in
40-
VStack(alignment: .leading, spacing: 8) {
41-
if let subTitle = subInfo.title {
42-
Text(subTitle)
43-
}
44-
VStack(alignment: .leading, spacing: 20) {
45-
ForEach(subInfo.description, id: \.self) { desciption in
46-
Text(desciption)
49+
ForEach(WuxiaInfo.dummyInfoList) { info in
50+
VStack(alignment: .leading, spacing: 26) {
51+
Text(info.title)
52+
.font(.customTitle3Bold)
53+
ForEach(info.infoList) { subInfo in
54+
VStack(alignment: .leading, spacing: 8) {
55+
if let subTitle = subInfo.title {
56+
Text(subTitle)
57+
}
58+
VStack(alignment: .leading, spacing: 20) {
59+
ForEach(subInfo.description, id: \.self) { desciption in
60+
Text(desciption)
61+
}
4762
}
63+
.opacity(0.7)
4864
}
49-
.opacity(0.7)
5065
}
5166
}
67+
.font(.customBody)
5268
}
53-
.font(.customBody)
5469
}
70+
.padding()
71+
.foregroundStyle(.white)
72+
.lineSpacing(8)
5573
}
56-
.padding()
57-
.foregroundStyle(.white)
58-
.lineSpacing(8)
5974
}
6075
}
6176
}
@@ -64,5 +79,5 @@ struct WuxiaInfoView: View {
6479

6580

6681
#Preview {
67-
WuxiaInfoView()
82+
WuxiaInfoView(isShowWuxiaInfo: .constant(true))
6883
}

0 commit comments

Comments
 (0)