// Card.swift
import Foundation
/*
This is your Card class.
It contains an instance of a Coordinate class that contains the latitude and longitude for a card.
It also contains a few example variables to show you how a class can be used.
*/
class Card: ObservableObject {
@Published var coord: Coordinate
@Published var name: String
@Published var city: String
init(coord: Coordinate, name: String, city: String) {
self.coord = coord
self.name = name
self.city = city
}
/*
This allows you to create an empty card, i.e. one with default values. You can do this in any of the following ways:
`var newCard: Card = Card.emptyCard`
`var newCard: Card = .emptyCard`
`var newCard = Card.emptyCard`
*/
static let emptyCard = Card(coord: Coordinate.zeroCoord, name: "", city: "")
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: