Started turning the ContentView -> PaceResults calculations into functions but as of this commit they don't work so it contains many errors. Also DID make the seconds work properly so 0:00:300 properly wraps to 0:05:00, and likewise, 0:00:86400 properly wraps to 24:00:00.

This commit is contained in:
Isaac Greene 2022-04-13 22:19:11 -04:00
parent addcb49778
commit 743d9cff0e
4 changed files with 46 additions and 8 deletions

View file

@ -10,6 +10,18 @@ import SwiftUI
struct April2022: View {
var body: some View {
ScrollView {
//2022-04-13
HStack {
VStack (alignment: .leading) {
Text("2022-04-13")
.font(.title2)
Text("Version Prerelease Build LVSXT10j\n")
.font(.footnote)
Text("\u{2022} Started work on optimizing code. Made no other changes and left the code with errors.")
}
Spacer()
}
.padding(30)
//2022-04-11
HStack {

View file

@ -71,17 +71,25 @@ struct PaceResults: View {
//var pacePerUnit = 0.0
//var notSelectedSystem = ""
let convertedSeconds = (Double(timeSeconds) ?? 0) * (1+(2/3))
let timeSecondsInt = Int(timeSeconds) ?? 0
let timeSecondsUnderSixty = (timeSecondsInt % 60)
func secondsConversion(timeSeconds: String) -> (timeSecondsInt: Int, timeSecondsUnderSixty: Int) {
let convertedSeconds = (Double(timeSeconds) ?? 0) * (1+(2/3))
let timeSecondsInt = Int(timeSeconds) ?? 0
let timeSecondsUnderSixty = (timeSecondsInt % 60)
return (timeSecondsInt, timeSecondsUnderSixty)
}
let timeSecondsToMinutes = (timeSecondsInt - timeSecondsUnderSixty) / 60
func minutesConversion(secondsConversion) {
let timeSecondsToMinutes = (timeSecondsInt - timeSecondsUnderSixty) / 60
let timeMinutesDouble = Double(timeMinutes) ?? 0.0
let timeMinutesDouble = Double(timeMinutes) ?? 0.0
let timeMinutesInt = (Int(timeMinutes) ?? 0) + (timeSecondsToMinutes)
let timeMinutesUnderSixty = timeMinutesInt % 60
let timeMinutesToHours = (timeMinutesInt - timeMinutesUnderSixty) / 60
return (timeMinutesUnderSixty, timeMinutesDouble, timeMinutesToHours)
}
let timeMinutesInt = (Int(timeMinutes) ?? 0) + (timeSecondsToMinutes)
let timeMinutesUnderSixty = timeMinutesInt % 60
let timeMinutesToHours = (timeMinutesInt - timeMinutesUnderSixty) / 60
let leadingZeros = String(format: "%02d:%02d", timeMinutesUnderSixty, timeSecondsUnderSixty)