diff --git a/Schedule ICTIS/ContentView.swift b/Schedule ICTIS/ContentView.swift index 396c9f3..6fa3ee8 100644 --- a/Schedule ICTIS/ContentView.swift +++ b/Schedule ICTIS/ContentView.swift @@ -2,7 +2,7 @@ // ContentView.swift // Schedule ICTIS // -// Created by G412 on 13.11.2024. +// Created by Mironov Egor on 13.11.2024. // import SwiftUI diff --git a/Schedule ICTIS/Helpers/Date+Extensions.swift b/Schedule ICTIS/Helpers/Date+Extensions.swift index 6f7608b..1acb7b6 100644 --- a/Schedule ICTIS/Helpers/Date+Extensions.swift +++ b/Schedule ICTIS/Helpers/Date+Extensions.swift @@ -2,7 +2,7 @@ // Date+Extensions.swift // Schedule ICTIS // -// Created by G412 on 14.11.2024. +// Created by Mironov Egor on 14.11.2024. // import SwiftUI diff --git a/Schedule ICTIS/Helpers/OffsetKey.swift b/Schedule ICTIS/Helpers/OffsetKey.swift index d65b82a..79e697e 100644 --- a/Schedule ICTIS/Helpers/OffsetKey.swift +++ b/Schedule ICTIS/Helpers/OffsetKey.swift @@ -2,7 +2,7 @@ // OffsetKey.swift // Schedule ICTIS // -// Created by G412 on 18.11.2024. +// Created by Mironov Egor on 18.11.2024. // import SwiftUI diff --git a/Schedule ICTIS/Helpers/View+Extensions.swift b/Schedule ICTIS/Helpers/View+Extensions.swift index 6f15aae..d1ad692 100644 --- a/Schedule ICTIS/Helpers/View+Extensions.swift +++ b/Schedule ICTIS/Helpers/View+Extensions.swift @@ -2,7 +2,7 @@ // View+Extensions.swift // Schedule ICTIS // -// Created by G412 on 15.11.2024. +// Created by Mironov Egor on 15.11.2024. // import SwiftUI diff --git a/Schedule ICTIS/Model/Model.swift b/Schedule ICTIS/Model/Model.swift index 435982f..a3ab6f6 100644 --- a/Schedule ICTIS/Model/Model.swift +++ b/Schedule ICTIS/Model/Model.swift @@ -1,8 +1,8 @@ // -// ViewModel.swift +// Model.swift // Schedule ICTIS // -// Created by G412 on 13.11.2024. +// Created by Mironov Egor on 13.11.2024. // import Foundation diff --git a/Schedule ICTIS/Network/NetworkError.swift b/Schedule ICTIS/Network/NetworkError.swift index c20ee5d..54acffa 100644 --- a/Schedule ICTIS/Network/NetworkError.swift +++ b/Schedule ICTIS/Network/NetworkError.swift @@ -1,6 +1,6 @@ // // NetworkError.swift -// NewsApp +// Schedule ICTIS // // Created by Mironov Egor on 18.11.2024. // diff --git a/Schedule ICTIS/Network/NetworkManager.swift b/Schedule ICTIS/Network/NetworkManager.swift index 5ed4319..3906615 100644 --- a/Schedule ICTIS/Network/NetworkManager.swift +++ b/Schedule ICTIS/Network/NetworkManager.swift @@ -1,8 +1,8 @@ // // NetworkManager.swift -// NewsApp +// Schedule ICTIS // -// Created by Egor Mironov on 18.11.2024. +// Created by Mironov Egor on 18.11.2024. // import Foundation @@ -12,7 +12,8 @@ final class NetworkManager { //MARK: Properties static let shared = NetworkManager() private let decoder = JSONDecoder() - private let urlString = "https://webictis.sfedu.ru/schedule-api/?query=%D0%BA%D1%82%D0%B1%D0%BE2-6" + private let urlForGroup = "https://webictis.sfedu.ru/schedule-api/?query=ктбо2-6" + private let urlForWeek = "https://webictis.sfedu.ru/schedule-api/?group=51.html&week=15" //MARK: Initializer private init() { @@ -21,7 +22,7 @@ final class NetworkManager { //MARK: Methods func getSchedule() async throws -> Schedule { - guard let url = URL(string: urlString) else { throw NetworkError.invalidUrl} + guard let url = URL(string: urlForGroup) else { throw NetworkError.invalidUrl} let (data, response) = try await URLSession.shared.data(from: url) guard let response = response as? HTTPURLResponse, response.statusCode == 200 else {throw NetworkError.invalidResponse} diff --git a/Schedule ICTIS/ScheduleView.swift b/Schedule ICTIS/ScheduleView.swift index 3a4512d..8abd1d9 100644 --- a/Schedule ICTIS/ScheduleView.swift +++ b/Schedule ICTIS/ScheduleView.swift @@ -2,7 +2,7 @@ // ScheduleView.swift // Schedule ICTIS // -// Created by G412 on 13.11.2024. +// Created by Mironov Egor on 13.11.2024. // import SwiftUI @@ -13,7 +13,7 @@ struct ScheduleView: View { @State private var weekSlider: [[Date.WeekDay]] = [] @State private var currentWeekIndex: Int = 1 @State private var createWeek: Bool = false - @StateObject var vm = ViewModel() + @ObservedObject var vm = ViewModel() var body: some View { VStack { @@ -61,6 +61,7 @@ struct ScheduleView: View { .cornerRadius(20) .padding(.horizontal, 10) .frame(maxWidth: 420, maxHeight: 130) + .shadow(color: Color.black.opacity(0.1), radius: 2, x: 4, y: 4) } .frame(height: 70) } diff --git a/Schedule ICTIS/Schedule_ICTISApp.swift b/Schedule ICTIS/Schedule_ICTISApp.swift index 483148f..b78f483 100644 --- a/Schedule ICTIS/Schedule_ICTISApp.swift +++ b/Schedule ICTIS/Schedule_ICTISApp.swift @@ -2,7 +2,7 @@ // Schedule_ICTISApp.swift // Schedule ICTIS // -// Created by G412 on 13.11.2024. +// Created by Mironov Egor on 13.11.2024. // import SwiftUI diff --git a/Schedule ICTIS/SearchBarView.swift b/Schedule ICTIS/SearchBarView.swift index 930bd1b..dcb6f6c 100644 --- a/Schedule ICTIS/SearchBarView.swift +++ b/Schedule ICTIS/SearchBarView.swift @@ -1,3 +1,10 @@ +// +// SearchBarView.swift +// Schedule ICTIS +// +// Created by Mironov Egor on 13.11.2024. +// + import SwiftUI struct SearchBarView: View { @@ -5,7 +12,7 @@ struct SearchBarView: View { @State private var isEditing = false var body: some View { - HStack { + HStack (spacing: 10) { HStack (spacing: 0) { Image(systemName: "magnifyingglass") .foregroundColor(Color.gray) @@ -19,41 +26,33 @@ struct SearchBarView: View { .onSubmit { self.isEditing = false } - ZStack { - Rectangle() - .frame(width: 40, height: 40) - .foregroundColor(.white) - .cornerRadius(15) - Group { - if isEditing { - Button { - self.text = "" - self.isEditing = false - UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) - } label: { - Image(systemName: "xmark.circle.fill") - .padding(.trailing, 20) - .offset(x: 10) - .foregroundColor(.gray) - .background( - ) - } - .background(Color.white) - } + if isEditing { + Button { + self.text = "" + self.isEditing = false + UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) + } label: { + Image(systemName: "xmark.circle.fill") + .padding(.trailing, 20) + .offset(x: 10) + .foregroundColor(.gray) + .background( + ) } - } + .background(Color.white) + } } + .frame(height: 40) .background( RoundedRectangle(cornerRadius: 10) .fill(.white) ) - Spacer() Button { } label: { ZStack { Rectangle() - .frame(width: 40) + .frame(width: 40, height: 40) .foregroundStyle(Color("blueColor")) .cornerRadius(15) Image(systemName: "plus") diff --git a/Schedule ICTIS/ViewModel/ViewModel.swift b/Schedule ICTIS/ViewModel/ViewModel.swift index f8b3d23..bda6c54 100644 --- a/Schedule ICTIS/ViewModel/ViewModel.swift +++ b/Schedule ICTIS/ViewModel/ViewModel.swift @@ -1,6 +1,6 @@ // // ViewModel.swift -// NewsApp +// Schedule ICTIS // // Created by Mironov Egor on 18.11.2024. //