Created
November 4, 2023 11:42
-
-
Save calvingit/d70f1cc8db8e12b801ce1ecf227f509b to your computer and use it in GitHub Desktop.
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
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