Skip to content

Commit 10ce04f

Browse files
committed
[FEAT] #34 Add LastView Animation
1 parent a57861b commit 10ce04f

File tree

3 files changed

+125
-99
lines changed

3 files changed

+125
-99
lines changed

Dietto/Dietto/Presentation/Article/View/ArticleView.swift

Lines changed: 75 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -16,44 +16,48 @@ struct ArticleView: View {
1616
]
1717
@StateObject var viewModel: ArticleViewModel
1818
var body: some View {
19-
NavigationView {
20-
VStack(alignment: .leading){
21-
HStack {
22-
//MARK: - 로고
23-
Text("Dietto")
24-
.font(.NerkoOne40)
25-
.foregroundStyle(.text)
26-
Spacer()
19+
ZStack{
20+
Color.backGround.ignoresSafeArea()
21+
22+
NavigationView {
23+
VStack(alignment: .leading){
24+
HStack {
25+
//MARK: - 로고
26+
Text("Dietto")
27+
.font(.NerkoOne40)
28+
.foregroundStyle(.text)
29+
Spacer()
30+
31+
NavigationLink(destination: InterestsView(viewModel: viewModel)) {
32+
Text("관심사 수정")
33+
.font(.pretendardMedium16)
34+
.foregroundColor(.white)
35+
.padding(.vertical, 4)
36+
.padding(.horizontal, 12)
37+
.background(Color.appMain)
38+
.clipShape(Capsule())
39+
}
40+
}
41+
.padding([.leading, .trailing], 16)
42+
Text("내 관심사")
43+
.font(.pretendardBold20)
44+
.padding(.leading, 16)
45+
Interests(
46+
topic: "",
47+
titles: viewModel.selectedInterests.map{$0.title},
48+
onClicked: {_ in },
49+
isSelected: {_ in true}
50+
).padding(.leading, 16)
2751

28-
NavigationLink(destination: InterestsView(viewModel: viewModel)) {
29-
Text("관심사 수정")
30-
.font(.pretendardMedium16)
31-
.foregroundColor(.white)
32-
.padding(.vertical, 4)
33-
.padding(.horizontal, 12)
34-
.background(Color.appMain)
35-
.clipShape(Capsule())
52+
List(articles, id: \.self) { item in
53+
LinkRow(previewURL: URL(string: item)!)
54+
.background(Color.backGround).ignoresSafeArea(.all)
3655
}
56+
.listStyle(.plain)
3757
}
38-
.padding([.leading, .trailing], 16)
39-
Text("내 관심사")
40-
.font(.pretendardBold20)
41-
.padding(.leading, 16)
42-
Interests(
43-
topic: "",
44-
titles: viewModel.selectedInterests.map{$0.title},
45-
onClicked: {_ in },
46-
isSelected: {_ in true}
47-
).padding(.leading, 16)
48-
49-
List(articles, id: \.self) { item in
50-
LinkRow(previewURL: URL(string: item)!)
51-
}
52-
.listStyle(.plain)
53-
5458
}
59+
.toolbarVisibility(.hidden, for: .navigationBar)
5560
}
56-
.toolbarVisibility(.hidden, for: .navigationBar)
5761
}
5862
}
5963

@@ -71,43 +75,43 @@ struct ArticleView: View {
7175
//
7276
/*
7377
[
74-
{
75-
"title": "계룡시, 등굣길 금연 캠페인 성황리에 마무리",
76-
"link": "https://www.news1.kr/articles/?5301234"
77-
},
78-
{
79-
"title": "영도구보건소, 금연구역 인증 걷기 챌린지 운영",
80-
"link": "https://www.news2.kr/articles/?5301235"
81-
},
82-
{
83-
"title": "광주시의회, 세계 금연의 날 맞아 금연 결의 대회 개최",
84-
"link": "https://www.news3.kr/articles/?5301236"
85-
},
86-
{
87-
"title": "팔굽혀펴기로 치매 예방하기?...근육량 증가하면 당뇨·치매 위험 낮아져 [Health Recipe]",
88-
"link": "https://www.healthnews.kr/articles/?5301237"
89-
},
90-
{
91-
"title": "노년층 복병 ‘골근감소증’ “장내 미생물 먹었더니”…뼈밀도·근육량 증가↑",
92-
"link": "https://www.healthnews.kr/articles/?5301238"
93-
},
94-
{
95-
"title": "체중 재증가하는 여성은 근육량보다 지방량 증가가 원인",
96-
"link": "https://www.healthnews.kr/articles/?5301239"
97-
},
98-
{
99-
"title": "금연 무기력함 극복하는 꿀팁 3가지를 소개합니다! : 네이버 블로그",
100-
"link": "https://blog.naver.com/PostView.nhn?blogId=example1&logNo=222123456789"
101-
},
102-
{
103-
"title": "근육량 증가, 근성장을 극대화해줄 꿀팁! - 네이버 블로그",
104-
"link": "https://blog.naver.com/PostView.nhn?blogId=example2&logNo=222123456790"
105-
},
106-
{
107-
"title": "지속 가능한 근육량 증가 운동 프로그램 : 네이버 블로그",
108-
"link": "https://blog.naver.com/PostView.nhn?blogId=example3&logNo=222123456791"
109-
}
78+
{
79+
"title": "계룡시, 등굣길 금연 캠페인 성황리에 마무리",
80+
"link": "https://www.news1.kr/articles/?5301234"
81+
},
82+
{
83+
"title": "영도구보건소, 금연구역 인증 걷기 챌린지 운영",
84+
"link": "https://www.news2.kr/articles/?5301235"
85+
},
86+
{
87+
"title": "광주시의회, 세계 금연의 날 맞아 금연 결의 대회 개최",
88+
"link": "https://www.news3.kr/articles/?5301236"
89+
},
90+
{
91+
"title": "팔굽혀펴기로 치매 예방하기?...근육량 증가하면 당뇨·치매 위험 낮아져 [Health Recipe]",
92+
"link": "https://www.healthnews.kr/articles/?5301237"
93+
},
94+
{
95+
"title": "노년층 복병 ‘골근감소증’ “장내 미생물 먹었더니”…뼈밀도·근육량 증가↑",
96+
"link": "https://www.healthnews.kr/articles/?5301238"
97+
},
98+
{
99+
"title": "체중 재증가하는 여성은 근육량보다 지방량 증가가 원인",
100+
"link": "https://www.healthnews.kr/articles/?5301239"
101+
},
102+
{
103+
"title": "금연 무기력함 극복하는 꿀팁 3가지를 소개합니다! : 네이버 블로그",
104+
"link": "https://blog.naver.com/PostView.nhn?blogId=example1&logNo=222123456789"
105+
},
106+
{
107+
"title": "근육량 증가, 근성장을 극대화해줄 꿀팁! - 네이버 블로그",
108+
"link": "https://blog.naver.com/PostView.nhn?blogId=example2&logNo=222123456790"
109+
},
110+
{
111+
"title": "지속 가능한 근육량 증가 운동 프로그램 : 네이버 블로그",
112+
"link": "https://blog.naver.com/PostView.nhn?blogId=example3&logNo=222123456791"
113+
}
110114
]
111-
112-
115+
116+
113117
*/

Dietto/Dietto/Presentation/Onboarding/View/LastView.swift

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,56 @@ struct LastView: View {
1111

1212
var nickName = ""
1313

14+
@State private var animating : Bool = false
15+
1416
var body: some View {
1517
ZStack {
16-
Color.backGround.ignoresSafeArea(.all)
18+
Color.backGround
19+
.ignoresSafeArea(.all)
20+
ZStack {
21+
VStack{
22+
if animating {
23+
Text("\(nickName)님의 ")
24+
+ Text("Challenge")
25+
.foregroundStyle(.text)
26+
+ Text("\n 응원합니다!")
27+
}
28+
}.multilineTextAlignment(.center)
29+
.foregroundColor(.appMain)
30+
.font(.pretendardBlack24)
31+
// VStack {
32+
// Spacer()
33+
// withAnimation(.easeInOut) {
34+
// Text("\(nickName)님의 Challenge를 응원합니다!")
35+
// .multilineTextAlignment(.center)
36+
// .foregroundColor(.appMain)
37+
// .font(.pretendardBlack24)
38+
// .padding()
39+
// }
40+
// Spacer()
41+
// Button {
42+
// // 다음으로 넘어가는 함수
43+
// } label: {
44+
// Text("시작하기")
45+
// .frame(maxWidth: .infinity)
46+
// .padding()
47+
// .background(Color.appMain)
48+
// .foregroundColor(.white)
49+
// .cornerRadius(13)
50+
// .font(.pretendardMedium16)
51+
// }
52+
// .padding(.horizontal, 20)
53+
// .padding(.bottom, 20)
54+
// }
55+
// .frame(maxHeight: .infinity, alignment: .center)
56+
}
57+
.animation(.easeInOut(duration: 1), value: animating)
58+
}.onAppear{
59+
animating = true
1760

18-
VStack {
19-
Spacer()
20-
withAnimation(.easeInOut) {
21-
Text("\(nickName)님의 Challenge를 응원합니다!")
22-
.multilineTextAlignment(.center)
23-
.foregroundColor(.appMain)
24-
.font(.pretendardBlack24)
25-
.padding()
26-
}
27-
Spacer()
28-
Button {
29-
// 다음으로 넘어가는 함수
30-
} label: {
31-
Text("시작하기")
32-
.frame(maxWidth: .infinity)
33-
.padding()
34-
.background(Color.appMain)
35-
.foregroundColor(.white)
36-
.cornerRadius(13)
37-
.font(.pretendardMedium16)
38-
}
39-
.padding(.horizontal, 20)
40-
.padding(.bottom, 20)
61+
DispatchQueue.main.asyncAfter(deadline: .now() + 4) {
62+
animating = false
4163
}
42-
.frame(maxHeight: .infinity, alignment: .center)
4364
}
4465
}
4566
}

Dietto/Dietto/Presentation/Onboarding/ViewModel/OnboardingViewModel.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ final class OnboardingViewModel: ObservableObject {
6464
return
6565
}
6666

67-
//최초
67+
//MARK: - 최초 진입
6868
if isFirstLaunch {
6969
let userEntity = UserEntity(
7070
id: currentUserId ?? UUID(),
@@ -82,11 +82,12 @@ final class OnboardingViewModel: ObservableObject {
8282

8383
isProfileSaved = true
8484

85-
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
85+
DispatchQueue.main.asyncAfter(deadline: .now() + 4) {
8686
self.isFirstLaunch = false
8787
self.isProfileSaved = false
8888
}
89-
//수정
89+
90+
//MARK: - 프로필 수정
9091
} else {
9192
guard let currentUserId = currentUserId else {
9293
fatalError("CurrentUser is nil") //없으면 말도 안되고 완전 꼬여버리기 때문에 일단 조치해둠

0 commit comments

Comments
 (0)