V8tr / KeyboardAvoidanceSwiftUI

How to move SwiftUI view up when keyboard appears https://www.vadimbulavin.com/how-to-move-swiftui-view-when-keyboard-covers-text-field/
https://www.vadimbulavin.com
The Unlicense
327 stars 36 forks source link

UITextView as FirstResponder #5

Closed ryanoff closed 4 years ago

ryanoff commented 4 years ago

Maybe I am missing something, but I'm having an issue that my SwiftUI view loads with a UITextView and in makeUIView I set to view.becomeFirstResponder.

When the view loads, the keyboard is shown immediately and the keyboardAdaptive does not push the view up. If I click the microphone button, then cancel it, keyboardAdaptive kicks in and moves up the view.

What should I be doing to have keyboardAdaptive run on load when a UITextView that needs to be immediately moved up is the FirstReponder.

You might be asking, why don't I just have the view moved up to begin with, but since the app runs on iPad and MacOS, a keyboard is not always always presented if there is a physical keyboard attached.