Files
SwiftUI/Examples/WorkingWithUIControls/StartingPoint/Landmarks/Landmarks/Models/Hike.swift
2019-06-06 11:16:28 +03:00

32 lines
670 B
Swift
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
See LICENSE folder for this samples licensing information.
Abstract:
The model for a hike.
*/
import SwiftUI
struct Hike: Codable, Hashable, Identifiable {
var name: String
var id: Int
var distance: Double
var difficulty: Int
var observations: [Observation]
static var formatter = LengthFormatter()
var distanceText: String {
return Hike.formatter
.string(fromValue: distance, unit: .kilometer)
}
struct Observation: Codable, Hashable {
var distanceFromStart: Double
var elevation: Range<Double>
var pace: Range<Double>
var heartRate: Range<Double>
}
}