Commit
This commit is contained in:
parent
155a175635
commit
0410575c8d
@ -2,7 +2,7 @@
|
|||||||
// ContentView.swift
|
// ContentView.swift
|
||||||
// Schedule ICTIS
|
// Schedule ICTIS
|
||||||
//
|
//
|
||||||
// Created by G412 on 13.11.2024.
|
// Created by Mironov Egor on 13.11.2024.
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Date+Extensions.swift
|
// Date+Extensions.swift
|
||||||
// Schedule ICTIS
|
// Schedule ICTIS
|
||||||
//
|
//
|
||||||
// Created by G412 on 14.11.2024.
|
// Created by Mironov Egor on 14.11.2024.
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// OffsetKey.swift
|
// OffsetKey.swift
|
||||||
// Schedule ICTIS
|
// Schedule ICTIS
|
||||||
//
|
//
|
||||||
// Created by G412 on 18.11.2024.
|
// Created by Mironov Egor on 18.11.2024.
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// View+Extensions.swift
|
// View+Extensions.swift
|
||||||
// Schedule ICTIS
|
// Schedule ICTIS
|
||||||
//
|
//
|
||||||
// Created by G412 on 15.11.2024.
|
// Created by Mironov Egor on 15.11.2024.
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
//
|
//
|
||||||
// ViewModel.swift
|
// Model.swift
|
||||||
// Schedule ICTIS
|
// Schedule ICTIS
|
||||||
//
|
//
|
||||||
// Created by G412 on 13.11.2024.
|
// Created by Mironov Egor on 13.11.2024.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// NetworkError.swift
|
// NetworkError.swift
|
||||||
// NewsApp
|
// Schedule ICTIS
|
||||||
//
|
//
|
||||||
// Created by Mironov Egor on 18.11.2024.
|
// Created by Mironov Egor on 18.11.2024.
|
||||||
//
|
//
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
//
|
//
|
||||||
// NetworkManager.swift
|
// NetworkManager.swift
|
||||||
// NewsApp
|
// Schedule ICTIS
|
||||||
//
|
//
|
||||||
// Created by Egor Mironov on 18.11.2024.
|
// Created by Mironov Egor on 18.11.2024.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
@ -12,7 +12,8 @@ final class NetworkManager {
|
|||||||
//MARK: Properties
|
//MARK: Properties
|
||||||
static let shared = NetworkManager()
|
static let shared = NetworkManager()
|
||||||
private let decoder = JSONDecoder()
|
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
|
//MARK: Initializer
|
||||||
private init() {
|
private init() {
|
||||||
@ -21,7 +22,7 @@ final class NetworkManager {
|
|||||||
|
|
||||||
//MARK: Methods
|
//MARK: Methods
|
||||||
func getSchedule() async throws -> Schedule {
|
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)
|
let (data, response) = try await URLSession.shared.data(from: url)
|
||||||
guard let response = response as? HTTPURLResponse, response.statusCode == 200 else {throw NetworkError.invalidResponse}
|
guard let response = response as? HTTPURLResponse, response.statusCode == 200 else {throw NetworkError.invalidResponse}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// ScheduleView.swift
|
// ScheduleView.swift
|
||||||
// Schedule ICTIS
|
// Schedule ICTIS
|
||||||
//
|
//
|
||||||
// Created by G412 on 13.11.2024.
|
// Created by Mironov Egor on 13.11.2024.
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
@ -13,7 +13,7 @@ struct ScheduleView: View {
|
|||||||
@State private var weekSlider: [[Date.WeekDay]] = []
|
@State private var weekSlider: [[Date.WeekDay]] = []
|
||||||
@State private var currentWeekIndex: Int = 1
|
@State private var currentWeekIndex: Int = 1
|
||||||
@State private var createWeek: Bool = false
|
@State private var createWeek: Bool = false
|
||||||
@StateObject var vm = ViewModel()
|
@ObservedObject var vm = ViewModel()
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack {
|
VStack {
|
||||||
@ -61,6 +61,7 @@ struct ScheduleView: View {
|
|||||||
.cornerRadius(20)
|
.cornerRadius(20)
|
||||||
.padding(.horizontal, 10)
|
.padding(.horizontal, 10)
|
||||||
.frame(maxWidth: 420, maxHeight: 130)
|
.frame(maxWidth: 420, maxHeight: 130)
|
||||||
|
.shadow(color: Color.black.opacity(0.1), radius: 2, x: 4, y: 4)
|
||||||
}
|
}
|
||||||
.frame(height: 70)
|
.frame(height: 70)
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Schedule_ICTISApp.swift
|
// Schedule_ICTISApp.swift
|
||||||
// Schedule ICTIS
|
// Schedule ICTIS
|
||||||
//
|
//
|
||||||
// Created by G412 on 13.11.2024.
|
// Created by Mironov Egor on 13.11.2024.
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
//
|
||||||
|
// SearchBarView.swift
|
||||||
|
// Schedule ICTIS
|
||||||
|
//
|
||||||
|
// Created by Mironov Egor on 13.11.2024.
|
||||||
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct SearchBarView: View {
|
struct SearchBarView: View {
|
||||||
@ -5,7 +12,7 @@ struct SearchBarView: View {
|
|||||||
@State private var isEditing = false
|
@State private var isEditing = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack {
|
HStack (spacing: 10) {
|
||||||
HStack (spacing: 0) {
|
HStack (spacing: 0) {
|
||||||
Image(systemName: "magnifyingglass")
|
Image(systemName: "magnifyingglass")
|
||||||
.foregroundColor(Color.gray)
|
.foregroundColor(Color.gray)
|
||||||
@ -19,41 +26,33 @@ struct SearchBarView: View {
|
|||||||
.onSubmit {
|
.onSubmit {
|
||||||
self.isEditing = false
|
self.isEditing = false
|
||||||
}
|
}
|
||||||
ZStack {
|
if isEditing {
|
||||||
Rectangle()
|
Button {
|
||||||
.frame(width: 40, height: 40)
|
self.text = ""
|
||||||
.foregroundColor(.white)
|
self.isEditing = false
|
||||||
.cornerRadius(15)
|
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
|
||||||
Group {
|
} label: {
|
||||||
if isEditing {
|
Image(systemName: "xmark.circle.fill")
|
||||||
Button {
|
.padding(.trailing, 20)
|
||||||
self.text = ""
|
.offset(x: 10)
|
||||||
self.isEditing = false
|
.foregroundColor(.gray)
|
||||||
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
|
.background(
|
||||||
} label: {
|
)
|
||||||
Image(systemName: "xmark.circle.fill")
|
|
||||||
.padding(.trailing, 20)
|
|
||||||
.offset(x: 10)
|
|
||||||
.foregroundColor(.gray)
|
|
||||||
.background(
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.background(Color.white)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
.background(Color.white)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
.frame(height: 40)
|
||||||
.background(
|
.background(
|
||||||
RoundedRectangle(cornerRadius: 10)
|
RoundedRectangle(cornerRadius: 10)
|
||||||
.fill(.white)
|
.fill(.white)
|
||||||
)
|
)
|
||||||
Spacer()
|
|
||||||
Button {
|
Button {
|
||||||
|
|
||||||
} label: {
|
} label: {
|
||||||
ZStack {
|
ZStack {
|
||||||
Rectangle()
|
Rectangle()
|
||||||
.frame(width: 40)
|
.frame(width: 40, height: 40)
|
||||||
.foregroundStyle(Color("blueColor"))
|
.foregroundStyle(Color("blueColor"))
|
||||||
.cornerRadius(15)
|
.cornerRadius(15)
|
||||||
Image(systemName: "plus")
|
Image(systemName: "plus")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// ViewModel.swift
|
// ViewModel.swift
|
||||||
// NewsApp
|
// Schedule ICTIS
|
||||||
//
|
//
|
||||||
// Created by Mironov Egor on 18.11.2024.
|
// Created by Mironov Egor on 18.11.2024.
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user