65 lines
2.0 KiB
Swift
65 lines
2.0 KiB
Swift
//
|
|
// SelectedVPKView.swift
|
|
// Schedule ICTIS
|
|
//
|
|
// Created by G412 on 30.01.2025.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct SelectingVPKView: View {
|
|
@FocusState private var isFocused: Bool
|
|
@State private var text: String = ""
|
|
var body: some View {
|
|
NavigationView {
|
|
VStack {
|
|
HStack (spacing: 0) {
|
|
Image(systemName: "magnifyingglass")
|
|
.foregroundColor(Color.gray)
|
|
.padding(.leading, 12)
|
|
.padding(.trailing, 7)
|
|
TextField("Поиск ВПК", text: $text)
|
|
.disableAutocorrection(true)
|
|
.focused($isFocused)
|
|
.onSubmit {
|
|
self.isFocused = false
|
|
if (!text.isEmpty) {
|
|
UserDefaults.standard.set(text, forKey: "group")
|
|
}
|
|
self.text = ""
|
|
}
|
|
.submitLabel(.done)
|
|
if isFocused {
|
|
Button {
|
|
self.text = ""
|
|
self.isFocused = false
|
|
} label: {
|
|
Image(systemName: "xmark.circle.fill")
|
|
.padding(.trailing, 20)
|
|
.offset(x: 10)
|
|
.foregroundColor(.gray)
|
|
.background(
|
|
)
|
|
}
|
|
}
|
|
}
|
|
.frame(height: 40)
|
|
.background(
|
|
RoundedRectangle(cornerRadius: 15)
|
|
.fill(.white)
|
|
)
|
|
.padding(.horizontal, 10)
|
|
Spacer()
|
|
}
|
|
.background(Color("background"))
|
|
.onTapGesture {
|
|
self.isFocused = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
SelectingVPKView()
|
|
}
|