    // todo: put in an extension or shared module or somesuch
    
    private var toolbar: UIToolbar!

    private func setupKeyboardToolbar() {
        NotificationCenter.default.addObserver(self, selector: #selector(kbShowing), name: UIResponder.keyboardWillShowNotification, object: nil)
        NotificationCenter.default.addObserver(self, selector: #selector(kbHiding), name: UIResponder.keyboardWillHideNotification, object: nil)
    }
    
    @objc func kbShowing(notification: Notification) {
        print(notification)
        
        guard let kbBounds = notification.userInfo?["UIKeyboardBoundsUserInfoKey"] as? CGRect else { return }
        
        if (toolbar == nil) {
            toolbar = UIToolbar()
            toolbar.barStyle = .default
            toolbar.isTranslucent = true
        }
        
        let spacer = UIBarButtonItem(barButtonSystemItem: .flexibleSpace)
        let done = UIBarButtonItem(barButtonSystemItem: .done) {
            self.view.endEditing(true)
        }
        
        toolbar.setItems([spacer, done], animated: true)
        
        view.addSubview(toolbar)
        
        toolbar.snp.makeConstraints { make in
            make.width.equalToSuperview()
            make.leading.trailing.equalToSuperview()
            make.bottom.equalToSuperview().offset(-kbBounds.height)
        }
    }
    
    @objc func kbHiding(notification: Notification) {
        toolbar?.removeFromSuperview()
        toolbar = nil
    }