mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-03-26 03:11:21 +01:00
43 lines
1011 B
Swift
Executable File
43 lines
1011 B
Swift
Executable File
/*
|
||
See LICENSE folder for this sample’s licensing information.
|
||
|
||
Abstract:
|
||
The model for an individual landmark.
|
||
*/
|
||
|
||
import SwiftUI
|
||
import CoreLocation
|
||
|
||
struct Landmark: Hashable, Codable, Identifiable {
|
||
var id: Int
|
||
var name: String
|
||
fileprivate var imageName: String
|
||
fileprivate var coordinates: Coordinates
|
||
var state: String
|
||
var park: String
|
||
var category: Category
|
||
var isFavorite: Bool
|
||
|
||
var locationCoordinate: CLLocationCoordinate2D {
|
||
CLLocationCoordinate2D(
|
||
latitude: coordinates.latitude,
|
||
longitude: coordinates.longitude)
|
||
}
|
||
|
||
func image(forSize size: Int) -> Image {
|
||
ImageStore.shared.image(name: imageName, size: size)
|
||
}
|
||
|
||
enum Category: String, CaseIterable, Codable, Hashable {
|
||
case featured = "Featured"
|
||
case lakes = "Lakes"
|
||
case rivers = "Rivers"
|
||
case mountains = "Mountains"
|
||
}
|
||
}
|
||
|
||
struct Coordinates: Hashable, Codable {
|
||
var latitude: Double
|
||
var longitude: Double
|
||
}
|