From 674979ebd355400b0e136968f42a1bdc8f8bafd2 Mon Sep 17 00:00:00 2001 From: Isaac Greene Date: Wed, 25 May 2022 22:27:05 -0400 Subject: [PATCH] reversed some previous progress --- Splits/ContentView.swift | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/Splits/ContentView.swift b/Splits/ContentView.swift index d337919..c5d6c03 100644 --- a/Splits/ContentView.swift +++ b/Splits/ContentView.swift @@ -69,8 +69,8 @@ struct PaceResults: View { var body: some View { let distanceDub = Double(distance) ?? 1.0 - var notSelectedSystem = "" - var pacePerUnit = 0.0 + //var notSelectedSystem = "" + //var pacePerUnit = 0.0 let convertedSeconds:Double = (Double(timeSeconds) ?? 0) * (1.666666666666666666666666) let timeSecondsInt:Int = Int(timeSeconds) ?? 0 @@ -90,22 +90,27 @@ struct PaceResults: View { let pace:Double = actualTime / distanceDub let paceString:String = String(format: "%.2f", pace) - if selectedSystem == "km" { - pacePerUnit = actualTime / (distanceDub * 1.609344) - notSelectedSystem = "mi" - } - else { - pacePerUnit = actualTime / (distanceDub * 0.6213711922) - notSelectedSystem = "km" - } + /* + func pacePerOpString(selectedSystem: String, _ pacePerUnit: inout Double, actualTime: Double, distanceDub: Double, _ notSelectedSystem: inout String) -> String { + if selectedSystem == "km" { + pacePerUnit = actualTime / (distanceDub * 1.609344) + notSelectedSystem = "mi" + } + else { + pacePerUnit = actualTime / (distanceDub * 0.6213711922) + notSelectedSystem = "km" + } - let pacePerUnitString = String(format: "%.02f", pacePerUnit) + let pacePerUnitString:String = String(format: "%.02f", pacePerUnit) + return pacePerUnitString + } + */ VStack { Text("Distance: \(distance)\(selectedSystem)") Text("Total time: \(timeMinutesToHours):\(leadingZeros)") Text("\(paceString) minutes per \(selectedSystem)") - Text("\(pacePerUnitString) minutes per \(notSelectedSystem)") + //Text("\(pacePerOpString(selectedSystem: selectedSystem, &pacePerUnit, actualTime: actualTime, distanceDub: distanceDub, ¬SelectedSystem)) minutes per \(notSelectedSystem)") } } }