Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added sample project and return Keyboard from the KeyboardObservingView #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SeRG1k17
Copy link

@SeRG1k17 SeRG1k17 commented May 30, 2020

  • 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
        }
    }
}

@nickffox
Copy link
Owner

nickffox commented Jun 6, 2020

Thanks! I’ll take a look at this over the weekend

@nickffox
Copy link
Owner

nickffox commented Jun 8, 2020

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants