SwiftUI: Function declares an opaque return type, but the return statements in its body do not have matching underlying types

You need to use @ViewBuilder in this case (and remove returns, because return disables ViewBuilder)

struct NavigationViewManager {
    @ViewBuilder
    static func make<V: View>(_ kind: NavigationViewKind, _ contentView: @escaping () -> V) -> some View {
        switch kind {
        case .test1(let text):
            NavigationView {
                contentView()
                    .navigationBarTitle(text, displayMode: .inline)
            }
        case .test2:
            NavigationView {
                contentView()
                    .navigationBarTitle("Initial", displayMode: .large)
            }
        }
    }
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)