Landmark.swift


  1. import Foundation
  2. import SwiftUI
  3. import CoreLocation
  4. struct Landmark: Hashable, Codable, Identifiable {
  5. var id: Int
  6. var name: String
  7. var park: String
  8. var state: String
  9. var description: String
  10. var isFavorite: Bool
  11. var isFeatured: Bool
  12. var category: Category
  13. enum Category: String, CaseIterable, Codable {
  14. case lakes = "Lakes"
  15. case rivers = "Rivers"
  16. case mountains = "Mountains"
  17. }
  18. private var imageName: String
  19. var image: Image {
  20. Image(imageName)
  21. }
  22. private var coordinates: Coordinates
  23. var locationCoordinate: CLLocationCoordinate2D {
  24. CLLocationCoordinate2D(
  25. latitude: coordinates.latitude,
  26. longitude: coordinates.longitude)
  27. }
  28. struct Coordinates: Hashable, Codable {
  29. var latitude: Double
  30. var longitude: Double
  31. }
  32. }