2021-12-02 SwiftUI NavigationLink Extraneous argument label isActive in call

Today, in Xcode 13.1, I got the following error:

    Extraneous argument label 'isActive:' in call

Accompanied by:

    Type '() -> EmptyView' cannot conform to 'StringProtocol'

This can be easily reproduced with the following code:

    struct ContentView: View {
        @State private var navigate = false
        var body: some View {
            NavigationLink(isActive: self.$navigate,
                           destination: Text("Hello, world!")) {
                EmptyView()
            }
        }
    }

Can you spot the problem above? I couldn't.

An alternative is when you try and specify the label parameter:

    struct ContentView: View {
        @State private var navigate = false
        var body: some View {
            NavigationLink(isActive: self.$navigate,
                           destination: Text("Hello, world!"),
                           label: {
                EmptyView()
            })
        }
    }

Then your errors become somewhat more clear:

    Generic parameter 'Destination' could not be inferred
    Cannot convert value of type 'Text' to expected argument type '() -> Destination'

Namely: the expected argument type to the destination parameter is a closure. As follows:

    destination: { Text("Hello, world!") }