Created
March 30, 2021 15:09
-
-
Save CrystalKnightCodes/db97ef188fd33acdefd928f8832654d5 to your computer and use it in GitHub Desktop.
TabView Tutorial Models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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