Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8924198
chore: #93 파일 이동
wotjs020708 Jan 18, 2026
e962602
feat: #93 버튼 추가
wotjs020708 Jan 18, 2026
941e2b3
Merge branch 'develop' into feat/#93-downtimemodelview
wotjs020708 Jan 18, 2026
9738fdb
feat: #93 PresentationDetent Exctension 추가
wotjs020708 Jan 18, 2026
16f0bcb
fix: #93 백그라운드 제거
wotjs020708 Jan 18, 2026
4527b98
feat: #93 sheet 설정 추가
wotjs020708 Jan 18, 2026
54c6e5a
chore: #93 파일 이동
wotjs020708 Jan 18, 2026
044087c
chore: #93 preview 삭제
wotjs020708 Jan 18, 2026
aae7aaa
style: #93 패딩 값 수정
wotjs020708 Jan 18, 2026
27a7246
chore: #93 줄 바꿈
wotjs020708 Jan 18, 2026
d91ad6e
fix: #93 앱 시작점 수정
wotjs020708 Jan 18, 2026
035d309
fix: #93 기존 코드로 복구
wotjs020708 Jan 18, 2026
1aa4587
style: #93 프로그래스바 패딩 수정
wotjs020708 Jan 18, 2026
3462c7e
feat: #93 선택된 시술 값 모달뷰로 넘기기
wotjs020708 Jan 18, 2026
213b94e
chore: #93 개행
wotjs020708 Jan 18, 2026
69d5358
feat: #93 오늘 날짜구하기, 문자열 -> 정수로 바꾸는 함수 구현
wotjs020708 Jan 18, 2026
6d83d44
feat: #93 날짜 수정되게 수정
wotjs020708 Jan 18, 2026
ca57c92
feat: #93 날짜 차 구해주는 extension 추가
wotjs020708 Jan 18, 2026
bca5de7
feat: #93 인자값 수정
wotjs020708 Jan 18, 2026
07419eb
feat: #93 화면 클릭시 키보드 내려가는 extension 추가
wotjs020708 Jan 18, 2026
5bd8c20
feat: #93 모달 구현 완료
wotjs020708 Jan 18, 2026
bd01f3d
style: #93 스크롤뷰 추가
wotjs020708 Jan 18, 2026
f91aaba
style: #93 여유기간 음수 안 보이게 수정
wotjs020708 Jan 18, 2026
d103644
chore: #93 컴포넌트 크기 조절 및 코드 리뷰 반영
wotjs020708 Jan 19, 2026
211614f
fix: #93 코리 반영
wotjs020708 Jan 19, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

struct TreatmentEntity: Equatable, Hashable {
struct TreatmentEntity: Identifiable, Equatable, Hashable {
var id: Self { self }
Comment on lines +10 to 11
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Selfid로 사용하면 속성 변경 시 SwiftUI가 아이템 동일성을 잃을 수 있습니다.

var id: Self { self }는 모든 속성이 동일해야 같은 아이템으로 인식됩니다. 속성이 변경되면 SwiftUI가 이를 새 아이템으로 간주하여 리스트 애니메이션이나 상태 유지에 문제가 발생할 수 있습니다.

안정적인 식별자(예: UUID 또는 고유한 name)를 사용하는 것이 권장됩니다.

🛠️ 제안된 수정
-struct TreatmentEntity: Identifiable, Equatable, Hashable {
-    var id: Self { self }
+struct TreatmentEntity: Identifiable, Equatable, Hashable {
+    let id: UUID = UUID()
     let name: String
     let benefits: [String]
     let downtimeMin: Int
     let downtimeMax: Int
 }

또는 name이 고유하다면:

var id: String { name }
🤖 Prompt for AI Agents
In `@Cherrish-iOS/Cherrish-iOS/Domain/Model/TreatmentEntity.swift` around lines 10
- 11, TreatmentEntity currently uses var id: Self { self }, which breaks SwiftUI
identity when any property changes; change to a stable identifier by adding a
stored unique id (e.g., let uuid: UUID) and implement var id: UUID { uuid } or,
if name is guaranteed unique, implement var id: String { name } and
remove/adjust any uses expecting Self as id; update initializers to set uuid and
ensure Equatable/Hashable semantics rely on the stable id instead of whole-self
equality.

Copy link
Contributor

Choose a reason for hiding this comment

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

id도 self 쓰나용??

let name: String
let benefits: [String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import SwiftUI

struct DownTimeSettingView: View {
@State var selectedTreatment: TreatmentEntity? = nil
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Optional 변수를 nil로 초기화하는 것은 불필요합니다.

Swift에서 Optional 타입은 기본값이 nil이므로 명시적 초기화가 필요하지 않습니다.

♻️ 제안된 수정
-    `@State` var selectedTreatment: TreatmentEntity? = nil
+    `@State` var selectedTreatment: TreatmentEntity?
🧰 Tools
🪛 SwiftLint (0.57.0)

[Warning] 11-11: 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/DownTimeSettingView.swift`
at line 11, Remove the unnecessary explicit nil initialization on the Optional
`@State` property by changing the declaration of selectedTreatment; since Optional
types default to nil in Swift, update the `@State` var selectedTreatment:
TreatmentEntity? = nil to simply `@State` var selectedTreatment: TreatmentEntity?
to clean up the code and adhere to Swift conventions.

var treatments: [TreatmentEntity]

let setday: (year: Int, month: Int, day: Int)
let today: (year: Int, month: Int, day: Int)
Comment on lines +11 to +14
Copy link
Contributor

Choose a reason for hiding this comment

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

이거 프라이빗 붙이면 좋을 것 같습니다!

var body: some View {
VStack {
Spacer()
Expand All @@ -27,7 +29,19 @@ struct DownTimeSettingView: View {
}
ScrollView(.vertical, showsIndicators: false) {
ForEach(treatments, id: \.self) { treatment in
TreatmentRowView(displayMode: .completeBoxView, treatmentEntity: treatment, isSelected: .constant(false), isCompleted: .constant(false), action: {})
TreatmentRowView(
displayMode: .completeBoxView,
treatmentEntity: treatment,
isSelected: .constant(
selectedTreatment == treatment
),
isCompleted: .constant(
false
),
action: {
selectedTreatment = treatment

})
Comment on lines +32 to +44
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -type f -name "DownTimeSettingView.swift" | head -5

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 174


🏁 Script executed:

cat -n ./Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Components/DownTimeSettingView.swift

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 3800


🏁 Script executed:

find . -type f -name "*.swift" | xargs rg "struct TreatmentRowView" -l

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 161


🏁 Script executed:

cat -n ./Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/Treatment/TreatmentRowView.swift

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 6911


읽기 전용 Binding으로 인해 토글 시 런타임 경고 유발

TreatmentCheckBoxView에서 isSelected.toggle()을 호출하는데(167줄), .constant() 바인딩은 읽기 전용이므로 런타임 경고를 유발합니다. 선택/해제 토글이 제대로 작동하도록 Binding(get:set:)으로 수정하세요.

🛠️ 제안 수정
-                        isSelected: .constant(
-                            selectedTreatment == treatment
-                        ),
+                        isSelected: Binding(
+                            get: { selectedTreatment == treatment },
+                            set: { newValue in
+                                selectedTreatment = newValue ? treatment : nil
+                            }
+                        ),
🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Components/DownTimeSettingView.swift`
around lines 32 - 44, The TreatmentRowView is passed a read-only Binding via
.constant(...) for isSelected which causes a runtime warning when
TreatmentCheckBoxView calls isSelected.toggle(); replace the .constant(...) with
a two-way Binding(get:set:) that returns whether selectedTreatment == treatment
and in the setter sets selectedTreatment = newValue ? treatment : nil (or clears
it appropriately) so toggling updates selectedTreatment; update the call site
where TreatmentRowView(...) is constructed to use this Binding and ensure
TreatmentCheckBoxView's isSelected.toggle() operates on that writable Binding.

}

Spacer()
Expand Down Expand Up @@ -64,9 +78,18 @@ struct DownTimeSettingView: View {
Spacer()
}
}

}
.padding(.horizontal, 25.adjustedW)
.sheet(item: $selectedTreatment) { treatment in
DowntimeBottomSheetView(
treatment: treatment,
today: today,
setday: setday
)
.presentationDetents([.extraLarge])
.presentationBackground(.gray0)
.presentationDragIndicator(.visible)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
import SwiftUI

struct DowntimeBottomSheetView: View {
@State var selectedDowntime: Int = 5
@State var rate: Double = 0.5
let treatment: TreatmentEntity
let today: (year: Int, month: Int, day: Int)
let setday: (year: Int, month: Int, day: Int)
@State private var selectedDowntime: Int = 1
@State private var rate: Double = 0.0
@State private var betweenDays: Int = 0

var body: some View {
VStack(spacing: 0) {
Spacer()
.frame(height: 25.adjustedH)
.frame(height: 35.adjustedH)

TypographyText("개인 다운타임으로 설정해주세요.", style: .title1_sb_18, color: .gray1000)
.frame(height: 27.adjustedH)
Expand All @@ -34,25 +38,52 @@ struct DowntimeBottomSheetView: View {

grayLineView
.padding(.horizontal, 25.adjustedW)

pickerView

grayLineView
.padding(.horizontal, 25.adjustedW)

Spacer()
.frame(height: 44.adjustedH)
buttonView

}
.onAppear {
selectedDowntime = treatment.downtimeMax
betweenDays = Date.daysBetween(from: setday, to: today) ?? 0
rate = betweenDays > 0 ? min(Double(selectedDowntime) / Double(betweenDays), 1.0) : 1.0
}
.onChange(of: selectedDowntime) {
rate = betweenDays > 0 ? min(Double(selectedDowntime) / Double(betweenDays), 1.0) : 1.0
}
Comment on lines +52 to 59
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's locate and examine the CherrishPicker component
fd -t f CherrishPicker

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 196


🏁 Script executed:

# Also find the Treatment model to check downtimeMax constraints
fd -t f Treatment

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 2047


🏁 Script executed:

# Let's examine the full DowntimeBottomSheetView file
fd -t f DowntimeBottomSheetView

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 176


🏁 Script executed:

# Examine the DowntimeBottomSheetView file
cat -n "Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Components/DowntimeBottomSheetView.swift"

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 8107


🏁 Script executed:

# Search for CherrishPicker definition
rg "struct CherrishPicker|class CherrishPicker" -t swift -A 20

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 2366


🏁 Script executed:

# Examine Treatment model
cat -n "Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Treatment/Model/Treatment.swift"

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 1674


🏁 Script executed:

# Search for TreatmentEntity definition
cat -n "Cherrish-iOS/Cherrish-iOS/Domain/Model/TreatmentEntity.swift"

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 3569


🏁 Script executed:

# Also search for CherrishPicker full implementation
cat -n "Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishPicker.swift"

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 3984


초기 선택값이 피커 범위를 벗어날 수 있습니다.

selectedDowntimetreatment.downtimeMax로 직접 설정하면, downtimeMaxCherrishPicker(range: 1...30) 범위를 초과하는 경우 선택기가 정상적으로 작동하지 않을 수 있습니다. 초기값을 범위 내로 클램핑해 주세요.

🛠️ 제안 수정
-            selectedDowntime = treatment.downtimeMax
+            selectedDowntime = min(max(treatment.downtimeMax, 1), 30)
📝 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
.onAppear {
selectedDowntime = treatment.downtimeMax
betweenDays = Date.daysBetween(from: setday, to: today) ?? 0
rate = betweenDays > 0 ? min(Double(selectedDowntime) / Double(betweenDays), 1.0) : 1.0
}
.onChange(of: selectedDowntime) {
rate = betweenDays > 0 ? min(Double(selectedDowntime) / Double(betweenDays), 1.0) : 1.0
}
.onAppear {
selectedDowntime = min(max(treatment.downtimeMax, 1), 30)
betweenDays = Date.daysBetween(from: setday, to: today) ?? 0
rate = betweenDays > 0 ? min(Double(selectedDowntime) / Double(betweenDays), 1.0) : 1.0
}
.onChange(of: selectedDowntime) {
rate = betweenDays > 0 ? min(Double(selectedDowntime) / Double(betweenDays), 1.0) : 1.0
}
🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Components/DowntimeBottomSheetView.swift`
around lines 52 - 59, Clamp the initial selectedDowntime to the picker's allowed
range instead of assigning treatment.downtimeMax directly: in the .onAppear
block (the closure that currently sets selectedDowntime = treatment.downtimeMax,
betweenDays, rate) replace that assignment with a clamped value (e.g.,
min(max(treatment.downtimeMax, 1), 30) or use the actual CherrishPicker range)
so the initial selectedDowntime always falls inside CherrishPicker(range:
1...30); keep the rest of the onAppear logic (betweenDays, rate) unchanged.

}
}

extension DowntimeBottomSheetView {

private var speechBubble: some View {
ZStack {
Image(.speechBubble)
.resizable()
.scaledToFill()
.frame(height: 53.adjustedH)

TypographyText("회복 목표디데이로부터 약 7일 전에 안정될 수 있어요.", style: .body1_r_14, color: .gray1000)
Group {
if betweenDays - selectedDowntime < 1 {
TypographyText(
"설정한 다운타임은 목표일을 넘깁니다.",
style: .body1_r_14,
color: .gray1000
)
} else {
TypographyText(
"회복 목표디데이로부터 약 \(betweenDays - selectedDowntime)일 전에 안정될 수 있어요.",
style: .body1_r_14,
color: .gray1000
)
}
}
.lineLimit(1)
.minimumScaleFactor(0.8)
.padding(.horizontal, 18.adjustedW)
Expand All @@ -72,8 +103,7 @@ extension DowntimeBottomSheetView {

Spacer ()

TypographyText("여유기간 7일", style: .title2_m_16, color: .gray800)

TypographyText("여유기간 \(betweenDays - selectedDowntime < 0 ? 0 : betweenDays - selectedDowntime)일", style: .title2_m_16, color: .gray800)
Spacer()
}

Expand All @@ -96,12 +126,12 @@ extension DowntimeBottomSheetView {
.padding(.horizontal, 25.adjustedW)

HStack {
TypographyText("1월 2일", style: .body2_r_13, color: .gray700)
TypographyText("\(today.month)월 \(today.day)일", style: .body2_r_13, color: .gray700)
.frame(height: 18.adjustedH)

Spacer()

TypographyText("1월 14일", style: .body2_r_13, color: .gray700)
TypographyText("\(setday.month)월 \(setday.day)일", style: .body2_r_13, color: .gray700)
.frame(height: 18.adjustedH)
}
.padding(.horizontal, 25.adjustedW)
Expand All @@ -119,10 +149,19 @@ extension DowntimeBottomSheetView {
Spacer()

VStack(spacing: 0) {
TypographyText("다운타임", style: .headline_sb_20, color: .gray1000)
TypographyText(
"다운타임",
style: .headline_sb_20,
color: .gray1000
)
.frame(height: 30.adjustedH)

TypographyText("보통 3-5일", style: .title2_m_16, color: .gray600)
TypographyText(
"보통 \(treatment.downtimeMin)-\(treatment.downtimeMax)일",
style: .title2_m_16,
color: .gray600
)
.frame(height: 24.adjustedH)
}

Spacer()
Expand All @@ -132,4 +171,37 @@ extension DowntimeBottomSheetView {
Spacer()
}
}

private var buttonView: some View {
GeometryReader { geo in
HStack(spacing: 4.adjustedW) {
CherrishButton(
title: "다운타임 없이 일정 추가",
type: .addEvent,
state: .constant(
.normal
),
leadingIcon: .none,
trailingIcon: .none,
action: { })
.frame(width: geo.size.width * 2/3 - 2)

CherrishButton(
title: "확인",
type: .small,
state: .constant(
.normal
),
leadingIcon: .none,
trailingIcon: .none,
action: { })
.frame(
width: geo.size.width * 1/3 - 2
)

}
}
.frame(height: 50.adjustedH)
.padding(.horizontal, 24.adjustedW)
}
Comment on lines 175 to 206
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -name "DowntimeBottomSheetView.swift" -type f

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 178


🏁 Script executed:

cat -n "Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Components/DowntimeBottomSheetView.swift" | sed -n '130,160p'

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 1143


🏁 Script executed:

cat -n "Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Components/DowntimeBottomSheetView.swift" | grep -A 20 "buttonView"

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 1650


🏁 Script executed:

wc -l "Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Components/DowntimeBottomSheetView.swift"

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 180


🏁 Script executed:

cat -n "Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Components/DowntimeBottomSheetView.swift" | sed -n '1,50p'

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 1650


GeometryReader 폭 계산이 외부 패딩을 고려하지 않아 오버플로우 위험

geo.size.width를 기반으로 버튼 너비를 계산한 뒤 GeometryReader 외부에 패딩을 적용하면, 패딩까지 포함된 전체 프레임이 할당된 공간을 초과할 수 있습니다. 패딩을 내부로 이동하고 폭 계산에서 양쪽 패딩(48.adjustedW)을 빼서 수정해주세요.

🛠️ 제안 변경
 private var buttonView: some View {
     GeometryReader { geo in
+        let total = geo.size.width - 48.adjustedW
         HStack(spacing: 4.adjustedW) {
             CherrishButton(title: "다운타임 없이 일정 추가", type: .addEvent, state: .constant(.normal), leadingIcon: .none, trailingIcon: .none, action: {})
-                .frame(width: geo.size.width * 2/3 - 2)
+                .frame(width: total * 2/3 - 2)

             CherrishButton(title: "확인", type: .small, state: .constant(.normal), leadingIcon: .none, trailingIcon: .none, action: {})
-                .frame(width: geo.size.width * 1/3 - 2)
+                .frame(width: total * 1/3 - 2)
             
         }
+        .padding(.horizontal, 24.adjustedW)
     }
-    .padding(.horizontal, 24.adjustedW)
 }
🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Calendar/Treatment/Components/DowntimeBottomSheetView.swift`
around lines 142 - 154, The GeometryReader-based width calc in buttonView
currently ignores the external .padding(.horizontal, 24.adjustedW); move the
horizontal padding inside the GeometryReader (apply it to the HStack) and change
the width calculations for the two CherrishButton frames to use (geo.size.width
- 48.adjustedW) as the available width (e.g. (geo.size.width - 48.adjustedW) *
2/3 - 2 and (geo.size.width - 48.adjustedW) * 1/3 - 2) so the buttons account
for both side paddings and avoid overflow.

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,67 +30,70 @@ struct TargetDdaySettingView: View {
@Binding var day: String

var body: some View {
VStack {
Spacer()
.frame(height: 50.adjustedH)

HStack(spacing:0){
VStack(alignment: .leading, spacing: 0) {
TypographyText("회복을 계획할 때 고려해야 할", style: .title1_sb_18, color: .gray1000)

TypographyText("중요한 일정이 있나요?", style: .title1_sb_18, color: .gray1000)
ScrollView(.vertical, showsIndicators: false) {
VStack {
Spacer()
.frame(height: 50.adjustedH)

HStack(spacing:0){
VStack(alignment: .leading, spacing: 0) {
TypographyText("회복을 계획할 때 고려해야 할", style: .title1_sb_18, color: .gray1000)

TypographyText("중요한 일정이 있나요?", style: .title1_sb_18, color: .gray1000)

}

Spacer()
}
.frame(height: 54.adjustedH)

Spacer()
}
.frame(height: 54.adjustedH)

Spacer()
.frame(height: 40)

HStack(spacing: 12.adjustedW) {
ForEach(DdayState.allCases, id: \.self) { state in
SelectionChip(
title: state.title,
isSelected: Binding(
get: {
dDayState == state
},
set: {isSelected in
guard isSelected else {
return
.frame(height: 40)

HStack(spacing: 12.adjustedW) {
ForEach(DdayState.allCases, id: \.self) { state in
SelectionChip(
title: state.title,
isSelected: Binding(
get: {
dDayState == state
},
set: {isSelected in
guard isSelected else {
return
}
dDayState = state
}
dDayState = state
}
)
)
)
}
}
}

Spacer()
.frame(height: 56.adjustedH)

if let state = dDayState {
HStack(spacing: 0) {
switch state {

Spacer()
.frame(height: 56.adjustedH)

if let state = dDayState {
HStack(spacing: 0) {
switch state {
case .yes:
TypographyText("언제까지 회복이 완료되면 좋을까요?", style: .title1_sb_18, color: .gray1000)
TypographyText("언제까지 회복이 완료되면 좋을까요?", style: .title1_sb_18, color: .gray1000)
case .no:
TypographyText("대략적인 회복 목표일을 정해볼까요?", style: .title1_sb_18, color: .gray1000)
TypographyText("대략적인 회복 목표일을 정해볼까요?", style: .title1_sb_18, color: .gray1000)
Comment on lines +79 to +81
Copy link
Contributor

Choose a reason for hiding this comment

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

프레임 한번만 주세요

}

Spacer()

}
.frame(height: 27.adjustedH)

Spacer()
.frame(height: 24.adjustedH)

DateTextBox(year: $year, month: $month, day: $day)
}

Spacer()
.frame(height: 24.adjustedH)

DateTextBox(year: $year, month: $month, day: $day)

}
}
.scrollDismissesKeyboard(.interactively)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,20 @@ struct NoTreatmentView: View {
NoTreatmentFilterView(viewModel: viewModel)

case .downTimeSetting:
DownTimeSettingView(treatments: viewModel.selectedTreatments)
DownTimeSettingView(
treatments: viewModel.selectedTreatments,
setday: (
viewModel.toInt(
viewModel.year
),
viewModel.toInt(
viewModel.month
),
viewModel.toInt(
viewModel.day
)
), today: viewModel.today
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ final class NoTreatmentViewModel: ObservableObject{
}
}

var today: (year: Int, month: Int, day: Int) {
let calendar = Calendar.current
let now = Date()
return (
calendar.component(.year, from: now),
calendar.component(.month, from: now),
calendar.component(.day, from: now)
)
}

func next() {
state.next()
}
Expand All @@ -40,6 +50,10 @@ final class NoTreatmentViewModel: ObservableObject{
state.previous()
}

func toInt(_ value: String) -> Int {
Int(value) ?? 0
}

func isDateTextFieldNotEmpty() -> Bool {
guard !year.isEmpty, !month.isEmpty, !day.isEmpty else {
return false
Expand Down
Loading