How to hide the keyboard on return for Swift Xcode apps

Xcode with Swift

Today, I will look at hiding the soft keyboard from the screen when entering information into a text field. It’s not a problem if you have a hardware keyboard which is the default for the Xcode simulator on the Mac or when you run on a device with a Bluetooth keyboard as the soft keyboard does not show. The issue is that once you are in a UITextField, the keyboard does not get dismissed by default and takes up the bottom section of the viewing area which quite often hides other controls. When I have finished with the form and