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 0000000..68f840b Binary files /dev/null and b/Schedule ICTIS/Assets.xcassets/arrowdown.imageset/arrow.png differ diff --git a/Schedule ICTIS/Assets.xcassets/arrowup.imageset/Contents.json b/Schedule ICTIS/Assets.xcassets/arrowup.imageset/Contents.json new file mode 100644 index 0000000..446d6be --- /dev/null +++ b/Schedule ICTIS/Assets.xcassets/arrowup.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Vector.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/arrowup.imageset/Vector.png b/Schedule ICTIS/Assets.xcassets/arrowup.imageset/Vector.png new file mode 100644 index 0000000..4d0fca6 Binary files /dev/null and b/Schedule ICTIS/Assets.xcassets/arrowup.imageset/Vector.png differ 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)