Firebase Notes App

I truly enjoyed building the Journal App. One question: how do I shift the whole view app when the keyboard appears? I tried several codes and the bodyText never shifts up

Hi @leptocode

Welcome to the community!!

Essentially you need to set a top constraint in the text field the is getting covered by the keyboard and slide it up. Here is the method I use:

    func slideUpTable() {
        
        topConstraint.constant = 130
        addLabel.isHidden = true
        
        //animate to the ending state
        UIView.animate(withDuration: 0.3, delay: 0, options: .curveEaseOut, animations: {
            
            self.topConstraint.constant = -130
            self.view.layoutIfNeeded()
            
        }, completion: (nil))
    }

I place in viewDidLoad the following code to listen for when a user taps into the field. And is calls the textBoxOn method.

vVin.addTarget(self, action: #selector(TextBoxOn(_:)),for: .editingDidBegin)

 @objc func TextBoxOn(_ textField: UITextField) {
        slideUpTable()
    }

I have a couple of method that uses the slide up and down methods. The down is essentially the same code, just reverse the constraint Int. You need to add UITextFieldDelegate delegate method to the ViewController for the .editingDidBegin to work.

Hope this makes sense.

Blessings,
—Mark