Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Keychy/Keychy/Core/Extensions/View+PullToRefresh.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ struct PullToRefreshModifier: ViewModifier {
}

/// Refresh 중 content를 밀어내는 Spacer
/// - Refresh 중: topPadding이 있으면 topPadding, 없으면 60px (일정한 간격 유지)
/// - Refresh 중: 항상 60px (일정한 간격 유지)
private var contentSpacer: some View {
Spacer()
.frame(height: shouldHoldIndicator ? max(topPadding, 60) : min(pullDistance * 0.3, 60))
.frame(height: shouldHoldIndicator ? 50 : min(pullDistance * 0.3, 50))
}

/// Pull to Refresh Indicator
Expand All @@ -90,7 +90,7 @@ struct PullToRefreshModifier: ViewModifier {
isRefreshing: isRefreshing
)
.allowsHitTesting(false)
.padding(.top, shouldHoldIndicator ? (topPadding == 0 ? 20 : topPadding + 40) : topPadding - 40)
.padding(.top, shouldHoldIndicator ? (topPadding == 0 ? 20 : topPadding + 20) : topPadding - 40)
}

/// 드래그 제스처
Expand Down Expand Up @@ -163,7 +163,7 @@ struct PullToRefreshModifier: ViewModifier {
}

DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
withAnimation(.spring(response: 0.4, dampingFraction: 1.0)) {
withAnimation(.easeOut(duration: 0.25)) {
shouldHoldIndicator = false
indicatorOpacity = 0
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ import SwiftUI

// MARK: - Normal Mode View
extension CollectionView {
/// 오버레이 헤더 높이 (headerSection + tagSection + collectionHeader)
/// - headerSection: 60(top padding) + ~40(buttons) + 2(padding) ≈ 102pt
/// - tagSection: 4(Spacing.xs) + 35(TabBar) ≈ 39pt
/// - collectionHeader: ~35pt (sortButton + spacing)
/// - 총합: ~185pt
private var overlayHeaderHeight: CGFloat { 185 }

// MARK: - Normal Mode View
var normalModeView: some View {
Group {
Expand Down Expand Up @@ -44,16 +51,26 @@ extension CollectionView {
}
}
} else {
// 정상 상태: 기존 VStack 형태
VStack {
headerSection
.padding(.horizontal, Spacing.margin)
.padding(.top, 2)
// 정상 상태: ZStack 오버레이 형태 (iOS 빌트인 탭 스크롤 지원)
ZStack(alignment: .top) {
// 전체 화면 ScrollView (pullToRefresh가 생성)
normalCollectionSection

tagSection
.padding(.horizontal, Spacing.xs)
// 고정 오버레이 헤더
VStack(spacing: 0) {
headerSection
.padding(.horizontal, Spacing.margin)
.padding(.top, 2)

normalCollectionSection
tagSection
.padding(.horizontal, Spacing.xs)

collectionHeader
.padding(.horizontal, Spacing.padding)
.padding(.top, 10)
.padding(.bottom, 12)
}
.background(Color.white)
}
.contentShape(Rectangle())
.onTapGesture {
Expand Down Expand Up @@ -147,35 +164,37 @@ extension CollectionView {
}

private var normalCollectionSection: some View {
VStack(spacing: 10) {
collectionHeader
.padding(.horizontal, Spacing.padding)
VStack(spacing: 0) {
// 오버레이 헤더 높이만큼 상단 여백
Spacer()
.frame(height: overlayHeaderHeight)

if filteredKeyrings.isEmpty {
emptyView
} else {
collectionGridView(keyrings: filteredKeyrings)
.padding(.horizontal, Spacing.xs)
.pullToRefresh(topPadding: 0) {
try? await Task.sleep(for: .seconds(1))
fetchUserData()
retryFailedCaches()
}
.simultaneousGesture(
DragGesture().onChanged { _ in
if showSearchBar {
isSearchFieldFocused = false

if !isSearching {
withAnimation(.spring(response: 0.3, dampingFraction: 0.8)) {
showSearchBar = false
}
}
}
}
)
.padding(.top, 20)
}
}
.pullToRefresh(topPadding: overlayHeaderHeight) {
try? await Task.sleep(for: .seconds(1))
fetchUserData()
retryFailedCaches()
}
.simultaneousGesture(
DragGesture().onChanged { _ in
if showSearchBar {
isSearchFieldFocused = false

if !isSearching {
withAnimation(.spring(response: 0.3, dampingFraction: 0.8)) {
showSearchBar = false
}
}
}
}
)
}

var collectionHeader: some View {
Expand Down
14 changes: 7 additions & 7 deletions functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion functions/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "functions",
"overrides": {
"lodash": "^4.17.21"
"lodash": "^4.17.21",
"fast-xml-parser": "^5.3.4"
},
"scripts": {
"build": "tsc",
Expand Down