Xcode 11 Beta 3, build error "Unknown attribute 'State'", "Use of undeclared type 'View'" etc

Shahar picture Shahar · Jul 10, 2019 · Viewed 12.1k times · Source

I build an app with the 2nd beta of Xcode 11, using SwiftUI, and everything worked completely fine, but now, with the 3rd beta, the app isn't even build. I get errors like "Use of undeclared type 'View'", "Unknown attribute 'State'" etc. What can I do? Is the problem in my code or is it just a bug?

The problem is when I'm trying to build the app to run on my Mac (with UIKit for Mac)

@State var score = 0

The error is "Unknown attribute 'State'"

struct ContentView : View {
    /*...*/
}

The error is "Use of undeclared type 'View'"

Answer

oroom picture oroom · Nov 27, 2019

Got same issue on Xcode 11.2. Found out that the reason was that somewhere in same module I declared protocol State {}. This breaks compiler without any reasonable errors.