Hello together,
i do have the following struct:
struct Ballpark: Identifiable, Codable, Comparable, Hashable {
@DocumentID var id: String? = UUID().uuidString // -> UUID of firestore document
var name: String
var street: String
var nr: Int?
var ext: String?
var city: String
var zip: Int?
var googleMaps: String
var category: String?
var location: GeoPoint? //= Coordinate(latitude: 0.0, longitude: 0.0)
var imageUrl: String?
enum CodingKeys: String, CodingKey {
case id
case name
case street
case nr
case city
case zip
case googleMaps = "google"
case category
case location = "geopoint"
case imageUrl
}
static func < (lhs: Ballpark, rhs: Ballpark) -> Bool {
return lhs.name.localizedCompare(rhs.name) == .orderedAscending
}
}
and I want to declare an @AppStorage var of type Ballpark, but I do get the error-message: “No exact matches in call to initializer”
@AppStorage("homeBallpark") var homeBallpark = Ballpark(id: nil, name: "", street: "", nr: nil, ext: nil, city: "", zip: nil, googleMaps: "", category: nil, location: GeoPoint(latitude: 0.0, longitude: 0.0), imageUrl: "")
I tried to initialize the ballpark var as an workaraound. In principal I want to declare the @AppStorage var as an optional
@AppStorage("homeBallpark") var homeBallpark: Ballpark?
GeoPoint is a class from FirebaseFireStore framework.
What am I doing wrong ?
Thanks and best regards
Peter