// // SearchBarView.swift // Schedule ICTIS // // Created by G412 on 13.11.2024. // import SwiftUI struct SearchBarView: View { @Binding var text: String @State private var isEditing = false var body: some View { HStack { TextField("Ввести номер группы", text: $text) .padding(7) .padding(.horizontal, 25) .background(.white) .cornerRadius(8) .overlay( HStack { Image(systemName: "magnifyingglass") .foregroundColor(.gray) .frame(minWidth: 0, maxWidth: .infinity, alignment: .leading) .padding(.leading, 8) if isEditing { Button(action: { self.text = "" self.isEditing = false UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) }) { Image(systemName: "multiply.circle.fill") .foregroundColor(.gray) .padding(.trailing, 8) } } } ) .onTapGesture { self.isEditing = true } Button { } label: { ZStack { Rectangle() .frame(width: 35, height: 35) .foregroundStyle(Color("blueColor")) .cornerRadius(10) Image(systemName: "plus") .resizable() .foregroundStyle(.white) .scaledToFit() .frame(width: 16) } } } .padding(.horizontal) } } #Preview { ScheduleView() }