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

Hiding view modifier with custom transitions #14

Merged
merged 4 commits into from Apr 5, 2020
Merged

Hiding view modifier with custom transitions #14

merged 4 commits into from Apr 5, 2020

Conversation

mkj-is
Copy link
Contributor

@mkj-is mkj-is commented Mar 25, 2020

Hello,

I was experimenting with your library and found one use-case it currently doesn't solve.

When you want some view to react on keyboard change with custom transition, you cannot currently do it. I iterated on the solution by @jaywardell, which always animated opacity. And I reimplemented it using view modifier.

Here is a typical use-case. I want to move some view out of the screen when keyboard appears:

recording

How to use it:

Image(systemName: "app.badge")
    .hideOnKeyboard(transition: .offset(x: 0, y: -300))

Let me know what you think about the solution.

@nickffox
Copy link
Owner

Thanks for this PR! I’ll take a look this weekend.

Comment on lines +12 to +14
/// - Warning: A Keyboard must be available in the Environment.
/// - Parameter transition: Transition which will be used to hide or show the view during keyboard presentation. By default it animated opacity.
/// - Returns: A view which is empty if keyboard is visible.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great documentation!

…eature/hiding-modifier

* 'master' of github.com:nickffox/KeyboardObserving:
  Update file header comment. (#15)
@nickffox nickffox merged commit 5511ad3 into nickffox:master Apr 5, 2020
@nickffox
Copy link
Owner

nickffox commented Apr 5, 2020

Thanks for this PR!

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