KeyboardObserving
KeyboardObserving copied to clipboard
Added sample project and return Keyboard from the KeyboardObservingView
- Added empty Example to the library.
- It will be useful if
KeyboardObservingView
will return Keyboard object as a parameter to ViewBuilder:
KeyboardObservingView { keyboard in
//
}
I found the issue, when you adding @EnvironmentObject var keyboard: Keyboard
to the View
. This leads to the fact that the field values are cleared after changing the field on this view or on the next in the nav stack.
- @nickffox What do you think, about using Environment?:
struct KeyboardKey: EnvironmentKey {
static let defaultValue: Keyboard = Keyboard()
}
extension EnvironmentValues {
var keyboard: Keyboard {
get {
return self[KeyboardKey.self]
}
set {
self[KeyboardKey.self] = newValue
}
}
}
Thanks! I’ll take a look at this over the weekend
@SeRG1k17 I took a look at this PR, and I’m a bit confused by the use case. Can you help me understand why a client might need access to the keyboard object?
Thanks for adding an empty project!