From ddceec85517a935ce89a71db15f25b6fceb79ac1 Mon Sep 17 00:00:00 2001 From: Vladimir Dubovik Date: Wed, 4 Dec 2024 14:22:11 +0300 Subject: [PATCH] Commit --- .../arrowdown.imageset/Contents.json | 21 ++++++++++++++++++ .../arrowdown.imageset/arrow.png | Bin 0 -> 221 bytes .../arrowup.imageset/Contents.json | 21 ++++++++++++++++++ .../arrowup.imageset/Vector.png | Bin 0 -> 222 bytes Schedule ICTIS/Helpers/Date+Extensions.swift | 5 ++++- Schedule ICTIS/ScheduleView.swift | 13 ++++++++++- 6 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 Schedule ICTIS/Assets.xcassets/arrowdown.imageset/Contents.json create mode 100644 Schedule ICTIS/Assets.xcassets/arrowdown.imageset/arrow.png create mode 100644 Schedule ICTIS/Assets.xcassets/arrowup.imageset/Contents.json create mode 100644 Schedule ICTIS/Assets.xcassets/arrowup.imageset/Vector.png diff --git a/Schedule ICTIS/Assets.xcassets/arrowdown.imageset/Contents.json b/Schedule ICTIS/Assets.xcassets/arrowdown.imageset/Contents.json new file mode 100644 index 0000000..4ce8416 --- /dev/null +++ b/Schedule ICTIS/Assets.xcassets/arrowdown.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "arrow.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Schedule ICTIS/Assets.xcassets/arrowdown.imageset/arrow.png b/Schedule ICTIS/Assets.xcassets/arrowdown.imageset/arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..68f840b7ad1d962f3e5005b4e58dac05c6bc6018 GIT binary patch literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^d_c^>!3HEx3Z6Ryq&N#aB8wRqxP?KOkzv*x37{Zj zage(c!@6@aFM%AEbVpxD28NCO+Al9|w>X8F{ck{PA6fp2|kS$Hf*~EWoS-6PG zO7r@C7qyZO_)J`v$SJL{_2tw#kC}cQlChpCeWK0(%qN~N@tnUuE%i^7vEO{!3HEx3Z6Ryq&N#aB8wRqxP?KOkzv*x37{Zj zage(c!@6@aFM%AEbVpxD28NCO+YvJ_M9>%Tj&#-;3vI=Ium(B>Z Op25@A&t;ucLK6V)_eMkj literal 0 HcmV?d00001 diff --git a/Schedule ICTIS/Helpers/Date+Extensions.swift b/Schedule ICTIS/Helpers/Date+Extensions.swift index 1acb7b6..9d17cdb 100644 --- a/Schedule ICTIS/Helpers/Date+Extensions.swift +++ b/Schedule ICTIS/Helpers/Date+Extensions.swift @@ -38,14 +38,17 @@ extension Date { var week: [WeekDay] = [] let weekForDate = calendar.dateInterval(of: .weekOfMonth, for: startOfDate) + //print("Start: \(weekForDate?.start)") + //print("End: \(weekForDate?.end)") guard let startOfWeek = weekForDate?.start else { return [] } + // Создаем дни для недели (0..<7).forEach { index in if let weekDay = calendar.date(byAdding: .day, value: index, to: startOfWeek) { - week.append(.init(date: weekDay)) + week.append(WeekDay(date: weekDay)) } } diff --git a/Schedule ICTIS/ScheduleView.swift b/Schedule ICTIS/ScheduleView.swift index 8abd1d9..fc7ef28 100644 --- a/Schedule ICTIS/ScheduleView.swift +++ b/Schedule ICTIS/ScheduleView.swift @@ -13,7 +13,8 @@ struct ScheduleView: View { @State private var weekSlider: [[Date.WeekDay]] = [] @State private var currentWeekIndex: Int = 1 @State private var createWeek: Bool = false - @ObservedObject var vm = ViewModel() + @State private var isShowingMonthSlider: Bool = false + @StateObject var vm = ViewModel() var body: some View { VStack { @@ -107,6 +108,16 @@ struct ScheduleView: View { Text(currentDate.format("MMMM")) .font(.system(size: 20, weight: .bold)) .foregroundStyle(Color("grayForDate")) + Spacer() + HStack (spacing: 2) { + Text(isShowingMonthSlider ? "Свернуть" : "Развернуть") + .font(.system(size: 15, weight: .light)) + .foregroundStyle(Color.blue) + Image(isShowingMonthSlider ? "arrowup" : "arrowdown") + } + .onTapGesture { + isShowingMonthSlider.toggle() + } } } .padding(.top, 8)