How can I cancel the text field editing. I want no other editing on the TextField
when the selection is made. I tried it myself, but I couldn't.
struct profile: View {
@State private var iliskiDurumlari: [String] = ["Evli", "Bekar", "Ayr?", "anan"]
@State private var iliskiVisible = false
@State private var iliski = ""
var body: some View {
VStack {
TextField("?li?ki Durumu Se?iniz..", text: $iliski)
.frame(width: 300, height: 50, alignment: .center)
.padding(5)
.font(Font.system(size: 15, weight: .medium, design: .serif))
.overlay(
RoundedRectangle(cornerRadius: 30)
.stroke(Color(red: 45 / 255, green: 0 / 255, blue: 112 / 255), lineWidth: 1)
)
.actionSheet(isPresented: $iliskiVisible, content: actionSheet)
.onTapGesture {
self.iliskiVisible.toggle()
}
}
}
func actionSheet() -> ActionSheet {
ActionSheet(
title: Text("Bir ?li?ki Durumu Se?iniz"),
message: Text("A?ag?da"),
buttons: iliskiDurumlari.map { value in
ActionSheet.Button.default(Text(value), action: {
self.iliski = value
})
}
)
}
}