Skip to content

Commit a0cefe0

Browse files
committed
[Feat] #202 - 앨범 선택 시 자연스러운 애니메이션 적용
1 parent f35b953 commit a0cefe0

1 file changed

Lines changed: 36 additions & 28 deletions

File tree

Neki-iOS/Features/Archive/Sources/Presentation/Sources/View/PhotoImportView.swift

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,40 +21,48 @@ struct PhotoImportView: View {
2121
header
2222
.padding(.top, 40)
2323

24-
if store.isFetchingPhotos && store.photos.isEmpty {
25-
Spacer()
26-
ProgressView()
27-
Spacer()
28-
} else if store.photos.isEmpty {
29-
Spacer()
30-
ArchiveEmptyView(description: "아직 등록된 사진이 없어요")
31-
Spacer()
32-
} else {
33-
ScrollView {
34-
VStack(spacing: 0) {
35-
LazyVGrid(columns: columns, spacing: 2) {
36-
ForEach(store.photos) { item in
37-
imageCell(for: item)
38-
.onAppear {
39-
if item == store.photos.last {
40-
store.send(.loadMorePhotos)
24+
ZStack {
25+
if store.isFetchingPhotos && store.photos.isEmpty {
26+
VStack {
27+
Spacer()
28+
ProgressView()
29+
Spacer()
30+
}
31+
} else if store.photos.isEmpty {
32+
VStack {
33+
Spacer()
34+
ArchiveEmptyView(description: "아직 등록된 사진이 없어요")
35+
Spacer()
36+
}
37+
} else {
38+
ScrollView {
39+
VStack(spacing: 0) {
40+
LazyVGrid(columns: columns, spacing: 2) {
41+
ForEach(store.photos) { item in
42+
imageCell(for: item)
43+
.onAppear {
44+
if item == store.photos.last {
45+
store.send(.loadMorePhotos)
46+
}
4147
}
42-
}
48+
}
49+
}
50+
.padding(.vertical, 12)
51+
.padding(.horizontal, 20)
52+
53+
if store.isFetchingPhotos && !store.photos.isEmpty {
54+
ProgressView()
55+
.padding(.vertical, 20)
56+
.padding(.bottom, 120)
57+
} else {
58+
Spacer().frame(height: 120)
4359
}
44-
}
45-
.padding(.vertical, 12)
46-
.padding(.horizontal, 20)
47-
48-
if store.isFetchingPhotos && !store.photos.isEmpty {
49-
ProgressView()
50-
.padding(.vertical, 20)
51-
.padding(.bottom, 120)
52-
} else {
53-
Spacer().frame(height: 120)
5460
}
5561
}
5662
}
5763
}
64+
.animation(.easeInOut(duration: 0.3), value: store.isFetchingPhotos)
65+
.animation(.easeInOut(duration: 0.3), value: store.photos)
5866
}
5967

6068
VStack(spacing: 0) {

0 commit comments

Comments
 (0)