Skip to content

Instantly share code, notes, and snippets.

@CrystalKnightCodes
Created March 30, 2021 15:09
Show Gist options
  • Save CrystalKnightCodes/db97ef188fd33acdefd928f8832654d5 to your computer and use it in GitHub Desktop.
Save CrystalKnightCodes/db97ef188fd33acdefd928f8832654d5 to your computer and use it in GitHub Desktop.
TabView Tutorial Models
import MapKit // So we can store coordinates.
/// A single location.
struct Place: Identifiable, Equatable, Hashable {
let id = UUID() // Required to conform to Identifiable
var name: String
var latitude: Double
var longitude: Double
var coordinate: CLLocationCoordinate2D {
CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
}
}
/// A group of locations visited in a single trip.
struct Vacation: Identifiable, Equatable, Hashable {
let id = UUID()
let name: String
let imageName: String
let places: [Place]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment