I found this solution for objective-c: Scroll UITextField above Keyboard in a UITableViewCell on a regular UIViewController but I can't adapt it for swift.
func textViewShouldBeginEditing(textView: UITextView) -> Bool {
var pointInTable:CGPoint? = textView.superview?.convertPoint(textView.frame.origin, toView: tableView)
var contentOffset:CGPoint = tableView.contentOffset
contentOffset.y = pointInTable?.y - textView.inputAccessoryView?.frame.size.height
}
I get error :
Value of optional type 'CGFloat?' not unwrapped; did you mean to use '!' or '?'?
When I use ! or ? I get error: Operand of postfix '?' should have optional type; type is 'CGFloat'