feat(home): 홈 탭 당겨서 새로고침을 추가한다
This commit is contained in:
@@ -18,9 +18,8 @@ struct MainHomeRecommendationView: View {
|
||||
Color.black
|
||||
.ignoresSafeArea()
|
||||
|
||||
if viewModel.isLoading && viewModel.recommendations == nil {
|
||||
ProgressView()
|
||||
.progressViewStyle(CircularProgressViewStyle(tint: .white))
|
||||
if viewModel.isLoading && viewModel.recommendations == nil && viewModel.errorMessage.isEmpty {
|
||||
loadingContent
|
||||
} else {
|
||||
ScrollView(showsIndicators: false) {
|
||||
VStack(alignment: .leading, spacing: SodaSpacing.s24) {
|
||||
@@ -83,6 +82,9 @@ struct MainHomeRecommendationView: View {
|
||||
}
|
||||
.padding(.vertical, SodaSpacing.s20)
|
||||
}
|
||||
.refreshable {
|
||||
await viewModel.refresh()
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
@@ -114,6 +116,20 @@ struct MainHomeRecommendationView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var loadingContent: some View {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(showsIndicators: false) {
|
||||
ProgressView()
|
||||
.progressViewStyle(CircularProgressViewStyle(tint: .white))
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
.refreshable {
|
||||
await viewModel.refresh()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct MainHomeRecommendationView_Previews: PreviewProvider {
|
||||
|
||||
Reference in New Issue
Block a user