Create a button and have an IBOutlet for it. When the user taps the button, it should take the input from the text field and store it in a string, like this: @IBAction func GuessButton(_ sender: AnyPreformatted text) {
This should get you going anyway. I figured out how to get the tapGesture in the TextField to dismiss the keyboard just not the empty space yet. I am out of time, but this should get you going ion the right direction anyway.
I can get this simple call to work with any upbeat in a HStack or VStack but how to capture the tap outside of the objects in the view have alluded me.
I am sure it can be done, I just have not the grey matter to figure it out! lol
Me neither mate… I have added a Button beside the Textfield which when tapping on the button and if the keyboard is showing… will Dismiss the keyboard…
It’s a bit clunky, so I will keep at it… I’ll let you know how I go.
I love the layout features of SwiftUI, but miss UIKit as well.
I do this as a hobby and keep the old brain clicking over, and meeting great people like yourself.
Hope your Christmas was great… the new year is next.
Hey further to this… As I managed to create a button to dismiss the keyboard when the button is tapped, how about if a button was the entire size of the screen but behind other controls, therefor when someone tapped on a blank piece of the screen, it would then tap the button and dismiss the keyboard?
Just not sure how to make a button behind other controls and also make it the entire size of the screen.