Skip to content

Instantly share code, notes, and snippets.

@paulhimes
Last active March 9, 2021 02:23
Show Gist options
  • Save paulhimes/795df361fe2aa2eeb435bb36ff619c5e to your computer and use it in GitHub Desktop.
Save paulhimes/795df361fe2aa2eeb435bb36ff619c5e to your computer and use it in GitHub Desktop.
OnLayout Tutorial 09
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