Skip to content

Instantly share code, notes, and snippets.

@vmanot
Created December 5, 2023 03:23
Show Gist options
  • Save vmanot/42c188d14fbf2b73eab626afe51c4583 to your computer and use it in GitHub Desktop.
Save vmanot/42c188d14fbf2b73eab626afe51c4583 to your computer and use it in GitHub Desktop.
Suppress NavigationView warnings on iOS 17.0/macOS 14.0
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 7.0, *)
@frozen
public struct _NavigationView<Content: View>: View {
private let content: Content
public init(@ViewBuilder content: () -> Content) {
self.content = content()
}
public var body: some View {
NavigationView {
content
}
}
}
extension NavigationLink {
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 7.0, *)
public init(
_isActive isActive: Binding<Bool>,
@ViewBuilder destination: () -> Destination,
@ViewBuilder label: () -> Label
) {
self.init(
isActive: isActive,
destination: destination,
label: label
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment