I have a textfield set in a VStack. Everything is as it should be except that the keyboard is no longer showing up. Where did I mess up? How can I get the keyboard to show again?
return VStack {
Image("food")
.resizable()
.aspectRatio(1.0, contentMode: .fit)
.clipShape(RoundedRectangle(cornerRadius: 50))
.gesture(longPressDrag)
.padding()
.offset(y: kGuardian.slide).animation(.basic(duration: 1.5))
.shadow(color: Color.black, radius: 15, x: 2, y: 2)
TextField("Leave a comment", text: $comment, onEditingChanged: { if $0 { self.kGuardian.showField = 0 } }) {
commentText = self.comment
}
.padding()
.background(GeometryGetter(rect: $kGuardian.rects[0]))
.background(Color(red: 239.0/255.0, green: 243.0/255.0, blue: 244.0/255.0, opacity: 1.0), cornerRadius: 10.0)
}
.padding()
.shadow(color: Color.black, radius: 15, x: 2, y: 2)
.offset(
x: viewState.width + dragState.translation.width
)
.presentation($showAlert) {
Alert(title: Text("User commented on this photo!"), message: Text(commentText), primaryButton: .default(Text("OK")) {
commentText = ""
self.comment = ""
}, secondaryButton: .cancel()
)
}