I'm pretty new to SwiftUI, so I started the Apple tutorial and followed the steps pretty closely, but I have come across this error at step 7 that says "Cannot find 'coordinates' in scope". I did a bit of searching and could not find anyone with the same problem, so I thought I'd post here.
import Foundation
import SwiftUI
import CoreLocation
struct Landmark: Hashable, Codable {
var id: Int
var name: String
var park: String
var state: String
var description: String
private var imageName: String
var locationCoordinate: CLLocationCoordinate2D {
CLLocationCoordinate2D(
latitude: coordinates.latitude,
longitude: coordinates.longitude)
}
var image: Image {
Image(imageName)
}
struct Coordinates: Hashable, Codable {
var latitude: Double
var longitude: Double
}
}
As far as I can tell, everything here is exactly as it is supposed to be. Could the tutorial be a different version of Xcode? Maybe this is a bug? I am not sure.
If any of the other code from the project is relevant I can add that. Any help is appreciated!