Last active
March 9, 2021 02:23
-
-
Save paulhimes/795df361fe2aa2eeb435bb36ff619c5e to your computer and use it in GitHub Desktop.
OnLayout Tutorial 09
This file contains 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
func layoutWatcher(_ proxy: GeometryProxy) -> some View { | |
/// This updates the height after each time the view | |
/// is updated. | |
DispatchQueue.main.async { | |
titleBarHeight = proxy.size.height | |
} | |
return Color.clear | |
.onAppear { | |
/// This updates the height when the view first | |
/// appears. | |
titleBarHeight = proxy.size.height | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment