UITextView with custom NSUndoManager breaks auto-enabling of software keyboard undo button

I have a custom UITextView where entering text causes the undo button in the software keyboard to be enabled. When I override the undo manager like this:

class TextView: UITextView {

    let _undoManager = UndoManager()

    override var undoManager: UndoManager? {
        return _undoManager
    }

}

the auto-enabling of the undo button doesn't work anymore. What is the correct way of providing my own undo manager?

I also want to set the UITextView's undoManager because I need to share undo/redo across multiple views on iPad. Any suggestions?

UITextView with custom NSUndoManager breaks auto-enabling of software keyboard undo button
 
 
Q