Getting circular reference error in my code here. Im new to swift, coming from javascript so i'm a little confused here

struct ContentView: View {
@StateObject var locationManager = locationManager()
var body: some View {
Text("hello world")
.padding()
}

}
the error is coming on the line with
@StateObject var locationManager = locationManager()

Your variable locationManager and your type being assigned to that variable have the same name. Typically, you start type names with a capital letter, which avoids this issue completely.

1 Like

That worked, Thanks !