I\'m trying to add a custom UIToolBar to all of my keyboards with as little repetition. The way I\'m currently doing it requires me to add the code to all my viewDidLoads and as
I have an utility that I've been using some time (ported to Swift from Objective-C) that does this and a little more, you might find it useful:
https://github.com/ncerezo/SwiftKeyboardAccessory
It creates a toolbar with at least a "Done" button to dismiss the keyboard, and optionally Next and Previous buttons. It also takes care of dismissing the keyboard when you tap outside the text field, and of resizing and scrolling the view when the keyboard appears or disappears. It's designed to work with UITableVIew and also with UIScrollView.