Conversation
📝 Walkthrough요약이 PR은 화면 크기에 대응하는 Adjust+ 익스텐션을 새로 추가하고, 여러 UI 컴포넌트의 고정 크기 값들을 반응형 크기 조정 프로퍼티(adjustedW/adjustedH)로 변경하며, Info.plist의 UIDesignRequiresCompatibility 설정을 false에서 true로 업데이트합니다. 변경사항
예상 코드 리뷰 난이도🎯 2 (Simple) | ⏱️ ~15 분 관련 PR
제안 라벨
제안 검토자
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/Adjust+.swift:
- Around line 23-33: The Double extension's adjustedW and adjustedH use
unnecessary full-expression Double(...) casting and duplicate logic; refactor by
extracting the scaling logic into a CGFloat extension (e.g., add computed
properties adjustedW and adjustedH on CGFloat that compute ratio using
UIScreen.main.bounds and constants 375/812), then have the Double extension call
that CGFloat conversion once (e.g., return CGFloat(self).adjustedW as Double) or
compute the ratio as a CGFloat and cast only the final result to Double,
removing the redundant Double(...) wrapping around the whole division.
- Around line 11-21: The extension on CGFloat uses deprecated
UIScreen.main.bounds and hard-coded magic numbers; update adjustedW and
adjustedH to obtain screen size via the active UIWindowScene (e.g., cast
UIApplication.shared.connectedScenes.first(where: { $0.activationState ==
.foregroundActive }) as? UIWindowScene and use its screen.bounds) and replace
the literals 375 and 812 with named constants (e.g., baseScreenWidth,
baseScreenHeight) defined near the extension; ensure you fall back to
UIScreen.main.bounds only if no active scene is found so the methods remain safe
in older iOS versions.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (7)
Cherrish-iOS/Cherrish-iOS/Info.plistCherrish-iOS/Cherrish-iOS/Presentation/Global/Component/Tabbar/CherrishTabBar.swiftCherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swiftCherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishNavigationBar.swiftCherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swiftCherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swiftCherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/Adjust+.swift
🔇 Additional comments (8)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishNavigationBar.swift (1)
59-60: LGTM!수직 레이아웃(높이, 수직 패딩)에
adjustedH를 올바르게 적용했습니다. 44pt는 표준 iOS 네비게이션 바 높이로 적절한 기준값입니다.Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift (1)
19-20: LGTM!높이에
adjustedH를 올바르게 적용했습니다.cornerRadius는 고정값으로 유지한 것도 적절합니다 - 코너 반경은 일반적으로 화면 크기와 비례하지 않는 것이 시각적으로 더 자연스럽습니다.Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift (1)
63-69: LGTM!버튼 높이에
adjustedH를 올바르게 적용했습니다.cornerRadius는 고정값으로 유지하여 다른 컴포넌트들(SelectionChip 등)과 일관성을 유지합니다.Cherrish-iOS/Cherrish-iOS/Presentation/Global/Component/Tabbar/CherrishTabBar.swift (2)
61-63: 아이콘 프레임의 가로/세로 비율 불일치 가능성.
width와height모두adjustedW를 사용하고 있습니다. 화면 비율이 기준값(375x812)과 다른 기기에서는 아이콘이 정사각형을 유지하지만, 의도가 "정사각형 유지"인지 "수직 방향도 화면에 맞게 조정"인지에 따라 접근이 달라질 수 있습니다.
- 정사각형 유지 의도: 현재 구현 유지 (둘 다
adjustedW또는 둘 다adjustedH)- 각 방향 독립 조정 의도:
height에adjustedH적용현재 구현이 의도된 것이라면 문제없습니다.
72-74: LGTM!수평 패딩에
adjustedW, 수직 패딩과 높이에adjustedH를 올바르게 적용했습니다. PR의 사용 지침을 정확히 따르고 있습니다.Cherrish-iOS/Cherrish-iOS/Info.plist (1)
12-13: iOS 26 Liquid Glass 비활성화를 위한 호환성 모드 설정이 적용되었습니다.
UIDesignRequiresCompatibility를true로 설정하여 앱이 iOS 26 Liquid Glass 디자인에서 벗어나고 하위 호환성을 유지합니다. 이 설정은 앱 전체에 적용되는 동작이며, 커밋 메시지에서 의도한 변경입니다.Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/Adjust+.swift (1)
35-43: LGTM!Int 확장이 CGFloat 확장에 위임하여 코드 중복을 방지하고 있습니다. 좋은 패턴입니다.
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift (1)
28-34: LGTM!기기 대응 익스텐션이 PR 가이드라인에 맞게 적용되었습니다:
- 수평 레이아웃(leading, horizontal padding) →
adjustedW- 수직 레이아웃(bottom, vertical padding, height) →
adjustedH
| extension CGFloat { | ||
| var adjustedW: CGFloat { | ||
| let ratio: CGFloat = UIScreen.main.bounds.width / 375 | ||
| return self * ratio | ||
| } | ||
|
|
||
| var adjustedH: CGFloat { | ||
| let ratio: CGFloat = UIScreen.main.bounds.height / 812 | ||
| return self * ratio | ||
| } | ||
| } |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
🧩 Analysis chain
🌐 Web query:
UIScreen.main deprecated iOS 16 UIWindowScene alternative
💡 Result:
Short answer: don't use UIScreen.main — get the UIScreen from the relevant UIWindowScene (or from a view/window's windowScene). For scale you can also use UITraitCollection.current.displayScale.
Examples:
- From a view or view controller:
let screen = view.window?.windowScene?.screen - From app scenes:
let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
let screen = windowScene?.screen - For display scale (no UIApplication):
let scale = UITraitCollection.current.displayScale
References: Apple recommendation to use the screen on the window scene, discussion/solutions (StackOverflow) and alternatives (UITraitCollection). [1][2][3]
Sources:
[1] Apple Developer (UIScreen docs / deprecation note).
[2] StackOverflow — "How do I get UIScreen.main.scale after iOS 16".
[3] Articles showing UIWindowScene / UITraitCollection alternatives.
🏁 Script executed:
# Find the actual file to verify its current state
find . -name "Adjust+.swift" -o -name "*Adjust*" | head -20Repository: TEAM-Cherrish/Cherrish-iOS
Length of output: 141
🏁 Script executed:
cat -n ./Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/Adjust+.swiftRepository: TEAM-Cherrish/Cherrish-iOS
Length of output: 1218
🏁 Script executed:
# Check if there are any usages of these adjusted properties in the codebase
rg "\.adjustedW|\.adjustedH" --type swift -A 2 -B 2 | head -30Repository: TEAM-Cherrish/Cherrish-iOS
Length of output: 2792
UIScreen.main이 iOS 16+에서 deprecated되었습니다.
UIScreen.main.bounds는 iOS 16 이상에서 deprecated되었으며, 현대적인 앱에서는 UIWindowScene을 통해 화면 정보를 가져와야 합니다. 또한 매직 넘버 375, 812를 상수로 추출하면 유지보수성이 향상됩니다.
♻️ 개선 제안
+private enum DesignSystem {
+ static let baseWidth: CGFloat = 375
+ static let baseHeight: CGFloat = 812
+}
+
extension CGFloat {
var adjustedW: CGFloat {
- let ratio: CGFloat = UIScreen.main.bounds.width / 375
+ let screenWidth = UIApplication.shared.connectedScenes
+ .compactMap { $0 as? UIWindowScene }
+ .first?.screen.bounds.width ?? DesignSystem.baseWidth
+ let ratio = screenWidth / DesignSystem.baseWidth
return self * ratio
}
var adjustedH: CGFloat {
- let ratio: CGFloat = UIScreen.main.bounds.height / 812
+ let screenHeight = UIApplication.shared.connectedScenes
+ .compactMap { $0 as? UIWindowScene }
+ .first?.screen.bounds.height ?? DesignSystem.baseHeight
+ let ratio = screenHeight / DesignSystem.baseHeight
return self * ratio
}
}🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/Adjust+.swift around
lines 11 - 21, The extension on CGFloat uses deprecated UIScreen.main.bounds and
hard-coded magic numbers; update adjustedW and adjustedH to obtain screen size
via the active UIWindowScene (e.g., cast
UIApplication.shared.connectedScenes.first(where: { $0.activationState ==
.foregroundActive }) as? UIWindowScene and use its screen.bounds) and replace
the literals 375 and 812 with named constants (e.g., baseScreenWidth,
baseScreenHeight) defined near the extension; ensure you fall back to
UIScreen.main.bounds only if no active scene is found so the methods remain safe
in older iOS versions.
| extension Double { | ||
| var adjustedW: Double { | ||
| let ratio: Double = Double(UIScreen.main.bounds.width / 375) | ||
| return self * ratio | ||
| } | ||
|
|
||
| var adjustedH: Double { | ||
| let ratio: Double = Double(UIScreen.main.bounds.height / 812) | ||
| return self * ratio | ||
| } | ||
| } |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Double 확장에서 불필요한 캐스팅이 있습니다.
UIScreen.main.bounds.width / 375의 결과는 이미 CGFloat이므로 Double(...) 캐스팅 한 번이면 충분합니다. 현재 코드는 나눗셈 전체를 감싸고 있어 의도대로 동작하지만, CGFloat 확장을 재사용하면 중복을 줄일 수 있습니다.
♻️ 중복 제거 제안
extension Double {
var adjustedW: Double {
- let ratio: Double = Double(UIScreen.main.bounds.width / 375)
- return self * ratio
+ return Double(CGFloat(self).adjustedW)
}
var adjustedH: Double {
- let ratio: Double = Double(UIScreen.main.bounds.height / 812)
- return self * ratio
+ return Double(CGFloat(self).adjustedH)
}
}🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/Adjust+.swift around
lines 23 - 33, The Double extension's adjustedW and adjustedH use unnecessary
full-expression Double(...) casting and duplicate logic; refactor by extracting
the scaling logic into a CGFloat extension (e.g., add computed properties
adjustedW and adjustedH on CGFloat that compute ratio using UIScreen.main.bounds
and constants 375/812), then have the Double extension call that CGFloat
conversion once (e.g., return CGFloat(self).adjustedW as Double) or compute the
ratio as a CGFloat and cast only the final result to Double, removing the
redundant Double(...) wrapping around the whole division.
🔗 연결된 이슈
📄 작업 내용
💻 주요 코드 설명
화면 크기 비율을 계산해서 다시 적용하는 익스텐션입니다.
호리존탈에는 adjustedW를, 버티컬에는 adjustedH를 적용해주시면 됩니다