-
Notifications
You must be signed in to change notification settings - Fork 0
[Style] #189 - 캘린더 UI #197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
sangyup12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
캘린더 커스텀 수고하셨습니다! 몰랐던 캘린더 커스텀에 쓰는 함수들이 많네영. 유튜브 영상이 서티 달력이랑 비슷해서 놀랐어여. 오늘 날짜와 선택한 날짜 분기 코드 잘봤습니다~!
| Button { | ||
| withAnimation { | ||
| viewModel.currentMonth -= 1 | ||
| } | ||
|
|
||
| } label: { | ||
| Image(.iconCalendarArrowRight) | ||
| .frame(width: 16, height: 16) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2
ArrowRight인데 왜 currentMonth가 -1이 되지? 라고 생각이 들었는데 이미지 에셋 이름이 Left, Right 잘못된 거 같아요! 함 확인해주시오
| @Published var homeStateModel = HomeStateModel() | ||
| @Published var selectedLicenseId: Int = 0 | ||
| @Published var homeViewRoute: HomeViewRoute? | ||
| @Published var currentDate: Date = .distantPast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.distantPast 이런 게 있었다니 신기해요
| func extractDate() -> [DateValueModel] { | ||
| let calendar = Calendar.current | ||
| let currentMonth = getCurrentMonth() | ||
|
|
||
| let currentMonthDays = currentMonth.getAllDates().compactMap { date -> DateValueModel in | ||
| let day = calendar.component(.day, from: date) | ||
| return DateValueModel(day: day, date: date, isCurrentMonth: true) | ||
| } | ||
|
|
||
| var days = currentMonthDays | ||
|
|
||
| let firstWeekday = calendar.component(.weekday, from: currentMonthDays.first!.date) | ||
|
|
||
| if let prevMonth = calendar.date(byAdding: .month, value: -1, to: currentMonth) { | ||
| let prevMonthDays = prevMonth.getAllDates() | ||
| let prefixDays = prevMonthDays.suffix(firstWeekday - 1) | ||
|
|
||
| let prevMonthValues = prefixDays.map { date in | ||
| DateValueModel(day: calendar.component(.day, from: date), date: date, isCurrentMonth: false) | ||
| } | ||
| days.insert(contentsOf: prevMonthValues, at: 0) | ||
| } | ||
|
|
||
| return days | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이번 달의 일과 이전 달의 일을 보여줘야할 게 있으면 합쳐서 반환하는 메서드 맞나여? 아니라면 설명 부탁슨..
🌴 작업한 브랜치
style/#189✅ 작업한 내용
캘린더 작업 완료했습니다!
❗️PR Point
네트워크 연결할 때 아래 내려오는 뷰는 따로 작업할게요
현재
DateValueModel을 통해 캘린더 UI를 관리해주고 있습니다!저도 잘 몰라서 유튜브 많이 참고해서 했어요.. 지적 환영합니다..
https://youtu.be/UZI2dvLoPr8?si=kl6tyj1F6QhZCzRf
📸 스크린샷
📟 관련 이슈