This is a nice alternate solution. For whatever reason, I was crashing and receiving an error “textfield.resignfirstresponder() unexpectedly found nil when unwrapping optional value” and I couldn’t exactly figure out what was causing it.