I have a UITextfield that i\'d like to dismiss the keyboard for. I can\'t seem to make the keyboard go away no matter what code i use.
I've discovered a case where endEditing and resignFirstResponder fail. This has worked for me in those cases.
[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];
[self setEditing:NO];
UIApplication.shared.sendAction(#selector(resignFirstResponder), to: nil, from: nil, for: nil)