I have a collection view I made in storyboard and a container view with text field constrained to the bottom of the view programmatically. However, when I show the keyboard the collection view stays hidden underneath and I'm not sure how to. I looked and most answers say to use self.view.frame.origin.y in the keyboard notification listener but that's hasn't worked for me.
my keyboard notification code
    @objc func keyboardWillShow(notification: NSNotification) {
        let keyboardFrame = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue
        let duration = ((notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue)!
        
        containerViewbottomAnchor?.constant = -keyboardFrame!.height
        
        UIView.animate(withDuration: duration) {
            self.view.layoutIfNeeded()
        }
        
    }first image is the normal chat and second is the max view you ca see when the keyboard is shown. the container view contains the textfield and button which I added programmatically. they are within an input accessory view to update their positions when the keyboard comes up.



 
    