I am thinking that the UIInputViewController on a keyboard extension has some limitations.
First problem:
I NEVER add a subview to inputView or view, yet when I create an instance of a view from a nib it AUTOMATICALLY sets that view as the default view. Not normal.
Second problem:
I have two separated views in a single XIB file.
One is for the letter keyboard (and its subviews) and the other is for the number keyboard (and its subviews). The only way I can get this keyboard to appear is to use:
self.view!.insertSubview(self.mainViewNumberKeyboard, aboveSubview: self.mainViewLetterKeyboard)
This makes it visible, but the view does not accept user interaction. The keys from the underlying letter keyboard intercepts all the views.
If I do self.mainviewLetterKeyboard.hidden = true
BOTH views disappear (letter and number keyboards). (This is where I think Apple may have a bug or issue - this should not happen)
I have similar problems if I have two separate XIB files each with their own keyboard. It appears that UIInputViewController does not like you to remove a view entirely from its superview.
Third Problem:
self.inputView doesn't seem to work. Adding subviews to it causes the keyboard to crash whereas self.view!.insertSubview seems to be the only way to get my number keyboard to appear
DESIRED RESULT
- User presses 123 button on keyboard
- Letter keyboard is removed from superview
- Number keyboard is added to UIInputViewController.view
- User presses ABC on number keyboard
- Number keyboard is removed from superview
- Letter keyboard is added to UIInputViewController.view
Anyone successfully add and remove MULTIPLE views on a keyboard extension?