Define your custom navigation view with two generic types. The first type is Content, which is used to pass views inside our custom navigation view. The second type is Destination, which is used to pass any destination view.

struct CustomNavigationView<Content: View, Destination : View>: View {
}
  • Content: A generic type that conforms to View. It will allow us to add a closure to provide multiple child views.
  • Destination: A generic type that conforms to View. It is used to pass a destination link.

#programming #swift #ios #mobile #swiftui

Create a Custom Navigation View in SwiftUI
8.85 GEEK