Created
May 4, 2020 17:11
-
-
Save michzio/e266a7a5d85d91b92f62e9386a4b334c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension View { | |
func registerKeyboardAvoider(_ avoider: KeyboardAvoider) -> some View { | |
self.onPreferenceChange(KeyboardAvoiderPreferenceKey.self) { prefs in | |
prefs.forEach { pref in | |
print("Avoider Rect: \(pref.rect)") | |
avoider.rects[pref.tag] = pref.rect | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment