I started dis app attempt last year and decide to retake on it. But since I updated to the last version of Xcode I started to hace this issue that I can't seem to figure it out. I was comparing it with another version of this same project that I had and I still don't understand the error. English ain't my first language, sorry for any misunderstanding.
Cannot find '' in scope
I tested a simplified version of your code with no problem:
- App declaration
import SwiftUI
@main
struct ForumApp: App {
@StateObject var model = Model()
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(model)
}
}
}
- Model file
import SwiftUI
import Combine
class Model: ObservableObject {
@Published var showDetails: Bool = false
}
- ContentView
import SwiftUI
struct ContentView: View {
@EnvironmentObject var model: Model
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!")
}
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
Group {
ContentView()
.environment(\.sizeCategory, .accessibilityLarge)
ContentView()
.preferredColorScheme(.dark)
.previewDevice("iPhone 13 mini")
}
.environmentObject(Model())
}
}
Could you show your project content:
I also tested in a MacOS App (your screenshots say it is MacOS) ; it works OK:
Hi, Im currently applying the changes that you post it. Thanks in advance for it.
I will attach a screenshot and if you have the time I can send you the Xcode file by email.