Skip to content

Comments

Hotfix/#126 쿼리파라미터 수정 및 자체QA 조금 #130

Merged
y-eonee merged 4 commits intodevelopfrom
hotfix/#126-쿼리파라미터-수정
Jan 21, 2026

Hidden character warning

The head ref may contain hidden characters: "hotfix/#126-\ucffc\ub9ac\ud30c\ub77c\ubbf8\ud130-\uc218\uc815"
Merged

Hotfix/#126 쿼리파라미터 수정 및 자체QA 조금 #130
y-eonee merged 4 commits intodevelopfrom
hotfix/#126-쿼리파라미터-수정

Conversation

@y-eonee
Copy link
Contributor

@y-eonee y-eonee commented Jan 21, 2026

🔗 연결된 이슈

📄 작업 내용

  • 쿼리파라미터 수정된게 반영이 안된 홈 api 엔드포인트 수정했습니다
  • 자체 QA 10퍼센트 정도했는데 여기서 수정할 수 있는 것만 했습니다
  • 홈에서 네비 연결했고, 캘린더 4주일때 5주일때 높이 수정했습니다
구현 내용 캘린더
GIF

@y-eonee y-eonee linked an issue Jan 21, 2026 that may be closed by this pull request
1 task
@y-eonee y-eonee requested review from a team, soseoyo12, sum130 and wotjs020708 and removed request for a team January 21, 2026 08:18
@y-eonee y-eonee self-assigned this Jan 21, 2026
@y-eonee y-eonee added 나연🐹 Hotfix 충돌해결 등 devlop에 바로 반영해야하는 경우 사용 labels Jan 21, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

HomeAPIqueryParameters 타입을 [String: String]?에서 [String: Any]?로 변경했고, 캘린더 관련으로 CalendarView의 viewModel 래퍼를 @ObservedObject에서 @StateObject로 전환하고 레이아웃 상수·그리드 생성 로직(CalendarViewModel.extractDate)을 재작성했습니다. 또한 HomeView의 일부 하위 뷰에 TabBarCoordinator 환경 객체를 주입하여 탭 전환 호출을 추가했습니다.

Changes

Cohort / File(s) 변경 사항
API 타입 수정
\Cherrish-iOS/Cherrish-iOS/Data/Network/EndPoint/HomeAPI.swift``
queryParameters 타입을 [String: String]?[String: Any]?로 변경 (타입 서명 변경)
Calendar 뷰 및 레이아웃
\Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/CalendarMain/CalendarView.swift``
@ObservedObject@StateObject로 viewModel 래퍼 변경, calendarCellWidth/Height/RowSpacing 상수 추가, 그리드 컬럼/셀 크기·간격·패딩 전반 조정 및 빈 슬롯 렌더링 방식 변경
Calendar 날짜 로직
\Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/CalendarMain/CalendarViewModel.swift``
extractDate 전면 재작성: Asia/Seoul 캘린더 사용, 7열 고정 그리드 생성 방식으로 변경, 월 외 날짜를 -1로 표시하도록 로직 변경
탭 네비게이션 통합
\Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Home/HomeView.swift``
ChallengeCardEmptyViewUpcomingBoxView@EnvironmentObject var tabBarCoordinator 추가, 빈 상태 버튼 액션을 tabBarCoordinator.switchTab(...) 호출로 교체

Sequence Diagram(s)

(생성 조건에 부합하지 않아 생략)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

Refactor

Suggested reviewers

  • soseoyo12
  • sum130
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning PR에는 이슈 #126(쿼리파라미터 수정)의 범위를 벗어난 네비게이션 연결과 캘린더 높이 수정 변경사항이 포함되어 있습니다. 쿼리파라미터 수정(#126)에 관련된 변경사항과 무관한 네비게이션 및 캘린더 UI 수정은 별도 PR로 분리하거나 명확한 이슈와 연결하세요.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 주요 변경사항인 쿼리파라미터 수정과 QA 작업을 언급하고 있으나, 실제 코드 변경에는 캘린더 높이 수정, 네비게이션 연결 등 추가 변경사항도 포함되어 있어 완전하지 않습니다.
Description check ✅ Passed 설명은 쿼리파라미터 수정, QA 작업, 네비게이션 연결, 캘린더 높이 수정 등 변경사항과 관련된 내용을 포함하고 있습니다.
Linked Issues check ✅ Passed 이슈 #126은 홈 API 쿼리파라미터 수정을 요구하며, PR에서 HomeAPI.swift의 queryParameters 타입을 변경하여 이를 충족합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hotfix/#126-쿼리파라미터-수정

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Home/HomeView.swift (1)

81-109: @EnvironmentObject TabBarCoordinator 주입 경로 누락으로 런타임 크래시 발생

ChallengeCardEmptyView@EnvironmentObject var tabBarCoordinator: TabBarCoordinator를 사용하지만, 뷰 계층에서 tabBarCoordinator가 전달되지 않습니다. TabBarCoordinatorView는 line 38에서 .environmentObject(tabBarCoordinator)를 적용하지만, line 20에서 HomeCoordinatorView에는 homeCoordinator만 전달하고 있습니다. 따라서 HomeView 및 그 자식 뷰들은 tabBarCoordinator에 접근할 수 없으며, 앱 실행 시 SwiftUI 환경 객체 해석 오류로 크래시가 발생합니다.

tabBarCoordinatorHomeCoordinatorView 계층까지 전달하거나, HomeView에서 다른 방식으로 네비게이션을 처리해야 합니다.

🤖 Fix all issues with AI agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/CalendarMain/CalendarView.swift`:
- Around line 35-40: The columns GridItem currently hardcodes dimensions; update
its definition to use the existing constants instead: replace the hardcoded
40.adjustedW with calendarCellWidth and the spacing 8 with calendarRowSpacing so
the columns array references calendarCellWidth and calendarRowSpacing (symbols:
calendarCellWidth, calendarRowSpacing, columns) for consistent, maintainable
sizing.
- Line 26: The CalendarView currently declares its injected CalendarViewModel
with `@StateObject` which is incorrect for externally created DI-injected
instances; update the property declaration in CalendarView to use
`@ObservedObject` instead of `@StateObject` so the view observes the externally
created model (refer to CalendarViewModel and the factory call
makeCalendarView(viewModel:) in ViewFactory to locate the injection point).

In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/CalendarMain/CalendarViewModel.swift`:
- Around line 138-162: The method extractDate uses several force-unwraps
(TimeZone(identifier: "Asia/Seoul")!, calendar.date(... )!,
calendar.date(byAdding:...)!, etc.); change these to safe unwrapping: guard-let
the TimeZone and create a Calendar only if the TZ exists, and guard-let the
computed dates (startOfMonth, gridStart, raw dates) where applicable, returning
an empty array or handling the error path if any creation fails; update
references to getCurrentMonth, startOfMonth, and gridStart to use the safely
unwrapped values so no '!' remains in extractDate.

struct CalendarView: View {
@EnvironmentObject private var calendarCoordinator: CalendarCoordinator
@ObservedObject var viewModel: CalendarViewModel
@StateObject var viewModel: CalendarViewModel
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Search for CalendarView instantiation patterns
rg -n "CalendarView\(" --type swift -C 3

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 2872


🏁 Script executed:

# Check CalendarView file for init and property declarations
fd "CalendarView.swift" --type f | xargs cat -n | head -100

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 3866


@StateObject 대신 @ObservedObject 사용 필요

CalendarViewModel이 외부의 DIContainer에서 생성되어 의존성 주입으로 전달되고 있습니다 (ViewFactory 라인 53-57, makeCalendarView(viewModel:) 호출). 이 경우 @StateObject 사용은 부적절합니다.

  • @StateObject: 뷰가 객체를 생성하고 소유할 때만 사용
  • @ObservedObject: 외부에서 주입된 객체를 관찰할 때 사용

현재 @StateObject로 선언하면 뷰 재생성 시 예기치 않게 새 인스턴스가 생성될 수 있습니다. @ObservedObject로 변경하세요.

🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/CalendarMain/CalendarView.swift`
at line 26, The CalendarView currently declares its injected CalendarViewModel
with `@StateObject` which is incorrect for externally created DI-injected
instances; update the property declaration in CalendarView to use
`@ObservedObject` instead of `@StateObject` so the view observes the externally
created model (refer to CalendarViewModel and the factory call
makeCalendarView(viewModel:) in ViewFactory to locate the injection point).

Comment on lines +35 to +40
private let calendarCellWidth: CGFloat = 40.adjustedW
private let calendarCellHeight: CGFloat = 40.adjustedH
private let calendarRowSpacing: CGFloat = 8.adjustedH

let weekdays: [String] = ["일", "월", "화", "수", "목", "금", "토"]
let columns = Array(repeating: GridItem(.fixed(40), spacing: 8), count: 7)
let columns = Array(repeating: GridItem(.fixed(40.adjustedW), spacing: 8), count: 7)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

상수 일관성 개선 권장

calendarCellWidth 상수가 정의되었지만 columns에서는 하드코딩된 40.adjustedW를 사용하고 있습니다. 유지보수성을 위해 상수를 사용하는 것이 좋습니다.

♻️ 상수 사용 권장
-    let columns = Array(repeating: GridItem(.fixed(40.adjustedW), spacing: 8), count: 7)
+    let columns = Array(repeating: GridItem(.fixed(calendarCellWidth), spacing: calendarRowSpacing), count: 7)
📝 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.

Suggested change
private let calendarCellWidth: CGFloat = 40.adjustedW
private let calendarCellHeight: CGFloat = 40.adjustedH
private let calendarRowSpacing: CGFloat = 8.adjustedH
let weekdays: [String] = ["", "", "", "", "", "", ""]
let columns = Array(repeating: GridItem(.fixed(40), spacing: 8), count: 7)
let columns = Array(repeating: GridItem(.fixed(40.adjustedW), spacing: 8), count: 7)
private let calendarCellWidth: CGFloat = 40.adjustedW
private let calendarCellHeight: CGFloat = 40.adjustedH
private let calendarRowSpacing: CGFloat = 8.adjustedH
let weekdays: [String] = ["", "", "", "", "", "", ""]
let columns = Array(repeating: GridItem(.fixed(calendarCellWidth), spacing: calendarRowSpacing), count: 7)
🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/CalendarMain/CalendarView.swift`
around lines 35 - 40, The columns GridItem currently hardcodes dimensions;
update its definition to use the existing constants instead: replace the
hardcoded 40.adjustedW with calendarCellWidth and the spacing 8 with
calendarRowSpacing so the columns array references calendarCellWidth and
calendarRowSpacing (symbols: calendarCellWidth, calendarRowSpacing, columns) for
consistent, maintainable sizing.

Comment on lines 138 to 162
private func extractDate(currentMonth: Int) -> [DateValue] {
let calendar = Calendar.current
var calendar = Calendar(identifier: .gregorian)
calendar.timeZone = TimeZone(identifier: "Asia/Seoul")!

let currentMonth = getCurrentMonth(addingMonth: currentMonth)
var days = currentMonth.getAllDates().compactMap { date -> DateValue in
let day = calendar.component(.day, from: date)
return DateValue(day: day, date: date)
}
let targetMonthDate = getCurrentMonth(addingMonth: currentMonth)
let startOfMonth = calendar.date(from: calendar.dateComponents([.year, .month], from: targetMonthDate))!
let daysInMonth = calendar.range(of: .day, in: .month, for: startOfMonth)?.count ?? 0

let firstWeekday = calendar.component(.weekday, from: days.first?.date ?? Date())
let firstWeekday = calendar.component(.weekday, from: startOfMonth)
let leading = firstWeekday - 1
let totalCells = leading + daysInMonth
let rows = Int(ceil(Double(totalCells) / 7.0))

for _ in 0 ..< firstWeekday - 1 {
days.insert(DateValue(day: -1, date: Date()), at: 0)
}
let gridStart = calendar.date(byAdding: .day, value: -leading, to: startOfMonth)!

return days
return (0..<(rows * 7)).map { i in
let raw = calendar.date(byAdding: .day, value: i, to: gridStart)!
let date = calendar.startOfDay(for: raw)

let isInTargetMonth = calendar.isDate(date, equalTo: targetMonthDate, toGranularity: .month)
let day = isInTargetMonth ? calendar.component(.day, from: date) : -1

return DateValue(day: day, date: date)
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

캘린더 그리드 생성 로직 개선 승인

단일 패스로 캘린더 그리드를 생성하는 깔끔한 리팩토링입니다. 타임존 처리가 일관성 있게 Asia/Seoul로 적용되었습니다.

참고: Line 140, 143, 151, 154에서 force unwrap(!)이 사용되고 있습니다. TimeZone(identifier: "Asia/Seoul")과 캘린더 연산은 일반적으로 안전하지만, 방어적 코딩을 위해 guard let을 고려해 볼 수 있습니다.

♻️ 방어적 코딩 예시 (선택사항)
 private func extractDate(currentMonth: Int) -> [DateValue] {
     var calendar = Calendar(identifier: .gregorian)
-    calendar.timeZone = TimeZone(identifier: "Asia/Seoul")!
+    calendar.timeZone = TimeZone(identifier: "Asia/Seoul") ?? .current
     
     let targetMonthDate = getCurrentMonth(addingMonth: currentMonth)
-    let startOfMonth = calendar.date(from: calendar.dateComponents([.year, .month], from: targetMonthDate))!
+    guard let startOfMonth = calendar.date(from: calendar.dateComponents([.year, .month], from: targetMonthDate)) else {
+        return []
+    }
🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/CalendarMain/CalendarViewModel.swift`
around lines 138 - 162, The method extractDate uses several force-unwraps
(TimeZone(identifier: "Asia/Seoul")!, calendar.date(... )!,
calendar.date(byAdding:...)!, etc.); change these to safe unwrapping: guard-let
the TimeZone and create a Calendar only if the TZ exists, and guard-let the
computed dates (startOfMonth, gridStart, raw dates) where applicable, returning
an empty array or handling the error path if any creation fails; update
references to getCurrentMonth, startOfMonth, and gridStart to use the safely
unwrapped values so no '!' remains in extractDate.

Copy link
Contributor

@wotjs020708 wotjs020708 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다. 리뷰 한번만 확인해주세요!

@@ -88,8 +96,6 @@ extension CalendarView {
}
}
.padding(.horizontal, 11)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요기 기기대응 추가 부탁드려욤


let weekdays: [String] = ["일", "월", "화", "수", "목", "금", "토"]
let columns = Array(repeating: GridItem(.fixed(40), spacing: 8), count: 7)
let columns = Array(repeating: GridItem(.fixed(40.adjustedW), spacing: 8), count: 7)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요기 spacing에도 기기대응 해야하나요?

Copy link
Contributor

@soseoyo12 soseoyo12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니당

Copy link
Contributor

@sum130 sum130 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고했어용 어푸푸우우

.frame(height: calendarCellHeight + calendarRowSpacing)
}
}
.padding(.horizontal, 23)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 기기대응해주세용

@y-eonee y-eonee merged commit a529710 into develop Jan 21, 2026
@y-eonee y-eonee deleted the hotfix/#126-쿼리파라미터-수정 branch January 21, 2026 11:44
@coderabbitai coderabbitai bot mentioned this pull request Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hotfix 충돌해결 등 devlop에 바로 반영해야하는 경우 사용 나연🐹

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Hotfix] 홈 api 쿼리파라미터 수정

4 participants