'nil' requires contextual type - SwiftUI / function builder bug?

Is this a bug related to function builders? The message makes no sense to me.

Error: 'nil' requires a contextual type

import SwiftUI
struct ContentView: View {
    var body: some View {
        var color: Color? = nil // Error here
        Text("Hello").foregroundColor(color)
    }    
}

Seems to be fixed on the March 23 5.4 Snapshot.

1 Like
Terms of Service

Privacy Policy

Cookie Policy