Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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'"

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...