Skip to content

Instantly share code, notes, and snippets.

@calvingit
Created November 4, 2023 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvingit/d70f1cc8db8e12b801ce1ecf227f509b to your computer and use it in GitHub Desktop.
Save calvingit/d70f1cc8db8e12b801ce1ecf227f509b to your computer and use it in GitHub Desktop.
extension View {
func hideNavigationBar(_ hidden: Bool = true) -> some View {
if #available(iOS 16.0, *) {
return self.toolbar(hidden ? .hidden : .visible)
} else {
// Fallback on earlier versions
return self.navigationBarHidden(hidden)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment