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:
parent
addcb49778
commit
743d9cff0e
4 changed files with 46 additions and 8 deletions
14
FizzBuzz.playground/Contents.swift
Normal file
14
FizzBuzz.playground/Contents.swift
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
for i in 1...100 {
|
||||||
|
if i.isMultiple(of: 3) && i.isMultiple(of: 5){
|
||||||
|
print("FizzBuzz")
|
||||||
|
}
|
||||||
|
else if i.isMultiple(of: 3) {
|
||||||
|
print("Fizz")
|
||||||
|
}
|
||||||
|
else if i.isMultiple(of: 5) {
|
||||||
|
print("Buzz")
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print(i)
|
||||||
|
}
|
||||||
|
}
|
||||||
4
FizzBuzz.playground/contents.xcplayground
Normal file
4
FizzBuzz.playground/contents.xcplayground
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<playground version='5.0' target-platform='ios' buildActiveScheme='true' importAppTypes='true'>
|
||||||
|
<timeline fileName='timeline.xctimeline'/>
|
||||||
|
</playground>
|
||||||
|
|
@ -10,6 +10,18 @@ import SwiftUI
|
||||||
struct April2022: View {
|
struct April2022: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView {
|
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
|
//2022-04-11
|
||||||
HStack {
|
HStack {
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,14 @@ struct PaceResults: View {
|
||||||
//var pacePerUnit = 0.0
|
//var pacePerUnit = 0.0
|
||||||
//var notSelectedSystem = ""
|
//var notSelectedSystem = ""
|
||||||
|
|
||||||
|
func secondsConversion(timeSeconds: String) -> (timeSecondsInt: Int, timeSecondsUnderSixty: Int) {
|
||||||
let convertedSeconds = (Double(timeSeconds) ?? 0) * (1+(2/3))
|
let convertedSeconds = (Double(timeSeconds) ?? 0) * (1+(2/3))
|
||||||
let timeSecondsInt = Int(timeSeconds) ?? 0
|
let timeSecondsInt = Int(timeSeconds) ?? 0
|
||||||
let timeSecondsUnderSixty = (timeSecondsInt % 60)
|
let timeSecondsUnderSixty = (timeSecondsInt % 60)
|
||||||
|
return (timeSecondsInt, timeSecondsUnderSixty)
|
||||||
|
}
|
||||||
|
|
||||||
|
func minutesConversion(secondsConversion) {
|
||||||
let timeSecondsToMinutes = (timeSecondsInt - timeSecondsUnderSixty) / 60
|
let timeSecondsToMinutes = (timeSecondsInt - timeSecondsUnderSixty) / 60
|
||||||
|
|
||||||
let timeMinutesDouble = Double(timeMinutes) ?? 0.0
|
let timeMinutesDouble = Double(timeMinutes) ?? 0.0
|
||||||
|
|
@ -83,6 +87,10 @@ struct PaceResults: View {
|
||||||
let timeMinutesUnderSixty = timeMinutesInt % 60
|
let timeMinutesUnderSixty = timeMinutesInt % 60
|
||||||
let timeMinutesToHours = (timeMinutesInt - timeMinutesUnderSixty) / 60
|
let timeMinutesToHours = (timeMinutesInt - timeMinutesUnderSixty) / 60
|
||||||
|
|
||||||
|
return (timeMinutesUnderSixty, timeMinutesDouble, timeMinutesToHours)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let leadingZeros = String(format: "%02d:%02d", timeMinutesUnderSixty, timeSecondsUnderSixty)
|
let leadingZeros = String(format: "%02d:%02d", timeMinutesUnderSixty, timeSecondsUnderSixty)
|
||||||
|
|
||||||
let actualTime = timeMinutesDouble + (convertedSeconds / 100)
|
let actualTime = timeMinutesDouble + (convertedSeconds / 100)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue