Conversation
📝 WalkthroughWalkthroughSelectedTreatmentView에 스크롤 위치 추적 기능을 추가하여 상단과 하단의 그라디언트 오버레이 표시 여부를 동적으로 제어합니다. TabBarCoordinatorView의 environmentObject 주입을 제거하고 onChange 핸들러를 간소화합니다. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
e564c7c to
47988a2
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Components/SelectedTreatmentView.swift`:
- Around line 24-26: The SwiftLint warning is caused by the redundant optional
initialization on the `@State` property initialTopGlobalY; remove the explicit "=
nil" so it reads "@State private var initialTopGlobalY: CGFloat?" to satisfy the
redundant_optional_initialization rule, leaving topGlobalY and bottomOffsetY
unchanged and ensure no other code relies on the explicit "= nil" initializer
for initialTopGlobalY.
- Around line 131-133: shouldShowGradientBottom currently reapplies adjustedH
and lacks a non-scroll guard, causing the bottom gradient to appear even when
content isn't scrollable; update the computed property
(shouldShowGradientBottom) to use scrollViewHeight as-is (remove the extra
.adjustedH application) and add a guard that the content is actually scrollable
(e.g., check contentHeight > scrollViewHeight or an isScrollable flag) before
computing remaining = bottomOffsetY - scrollViewHeight, then return remaining >
1; reference the bottomOffsetY, scrollViewHeight, adjustedH and
shouldShowGradientBottom symbols when making the change.
| @State private var topGlobalY: CGFloat = .zero | ||
| @State private var initialTopGlobalY: CGFloat? = nil | ||
| @State private var bottomOffsetY: CGFloat = .zero |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
옵셔널 nil 초기화 제거로 린트 경고 해소
SwiftLint의 redundant_optional_initialization 경고가 나옵니다. = nil을 제거해도 동작은 동일합니다.
♻️ 제안 변경
- `@State` private var initialTopGlobalY: CGFloat? = nil
+ `@State` private var initialTopGlobalY: CGFloat?📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| @State private var topGlobalY: CGFloat = .zero | |
| @State private var initialTopGlobalY: CGFloat? = nil | |
| @State private var bottomOffsetY: CGFloat = .zero | |
| `@State` private var topGlobalY: CGFloat = .zero | |
| `@State` private var initialTopGlobalY: CGFloat? | |
| `@State` private var bottomOffsetY: CGFloat = .zero |
🧰 Tools
🪛 SwiftLint (0.57.0)
[Warning] 25-25: Initializing an optional variable with nil is redundant
(redundant_optional_initialization)
🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Components/SelectedTreatmentView.swift`
around lines 24 - 26, The SwiftLint warning is caused by the redundant optional
initialization on the `@State` property initialTopGlobalY; remove the explicit "=
nil" so it reads "@State private var initialTopGlobalY: CGFloat?" to satisfy the
redundant_optional_initialization rule, leaving topGlobalY and bottomOffsetY
unchanged and ensure no other code relies on the explicit "= nil" initializer
for initialTopGlobalY.
| private var shouldShowGradientBottom: Bool { | ||
| let remaining = bottomOffsetY - scrollViewHeight.adjustedH | ||
| return remaining > 1 |
There was a problem hiding this comment.
하단 그라디언트가 비스크롤 상태에서도 노출될 수 있습니다
scrollViewHeight는 이미 adjustedH가 반영된 값인데 다시 adjustedH를 적용하고, 비스크롤 상태 가드가 없어 패딩 차이로 하단 그라디언트가 항상 보일 수 있습니다. 조건을 보강해 주세요.
🐛 제안 변경
- private var shouldShowGradientBottom: Bool {
- let remaining = bottomOffsetY - scrollViewHeight.adjustedH
- return remaining > 1
- }
+ private var shouldShowGradientBottom: Bool {
+ guard selectedTreatments.count > maxVisibleCount else { return false }
+ let remaining = bottomOffsetY - scrollViewHeight
+ return remaining > 1
+ }🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Components/SelectedTreatmentView.swift`
around lines 131 - 133, shouldShowGradientBottom currently reapplies adjustedH
and lacks a non-scroll guard, causing the bottom gradient to appear even when
content isn't scrollable; update the computed property
(shouldShowGradientBottom) to use scrollViewHeight as-is (remove the extra
.adjustedH application) and add a guard that the content is actually scrollable
(e.g., check contentHeight > scrollViewHeight or an isScrollable flag) before
computing remaining = bottomOffsetY - scrollViewHeight, then return remaining >
1; reference the bottomOffsetY, scrollViewHeight, adjustedH and
shouldShowGradientBottom symbols when making the change.


🔗 연결된 이슈
📄 작업 내용