Fixed issue where entering a distance of less than .1 crashed the app. Formatted the primary distance to three decimal paces. Added a "Clear" button which sets all text fields to "". Moved app back to Release Candidate.

This commit is contained in:
Isaac Greene 2022-06-16 23:37:45 -04:00
parent 7aa899ca7d
commit af513b8c05
4 changed files with 155 additions and 118 deletions

View file

@ -10,6 +10,21 @@ import SwiftUI
struct June2022: View {
var body: some View {
ScrollView {
//2022-06-16
HStack {
VStack (alignment: .leading) {
Text("2022-06-16")
.font(.title2)
Text("Version Release Candidate 3\n")
.font(.footnote)
Text("\u{2022} You can now enter any distance you want without the app crashing\n\u{2022} Formatted the primary distance to three decimal places")
}
Spacer()
}
.padding(30)
// has ten days of logs
VStack {
//2022-06-15
HStack {
VStack (alignment: .leading) {
@ -142,6 +157,7 @@ struct June2022: View {
}
.padding(30)
}
}
.navigationTitle("June 2022 Log")
.navigationBarTitleDisplayMode(.inline)
}

View file

@ -43,6 +43,13 @@ struct ContentView: View {
Button("Done") {
nameIsFocused = false
}
Button("Clear") {
distance = ""
timeHours = ""
timeMinutes = ""
timeSeconds = ""
}
Spacer()
Button("Next") {
if focusedField == .distance {
focusedField = .hours
@ -117,7 +124,7 @@ struct PaceResults: View {
@Binding var distance: String
var body: some View {
let distanceDub:Double = Double(removeLeadingZeros(distance: &distance)) ?? 1.0
let distanceDub:Double = ((Double(distance) != 0 ? Double(removeLeadingZeros(distance: &distance)) ?? 1.0 : 1.0))
// because of some conversions I have to do,
// this constant is a double just to make things easier.
// this has to be one because the pace is calculated
@ -210,7 +217,7 @@ struct PaceResults: View {
HStack {
VStack (alignment: .leading) {
Text("\(distance)\(selectedSystem)")
Text("\(roundString(Double(removeLeadingZeros(distance: &distance)) ?? 0))\(selectedSystem)")
Text("\(convertedDistanceString)\(notSelectedSystem)")
}
.frame(minWidth: 100)
@ -230,6 +237,15 @@ struct PaceResults: View {
}
return distance
}
func roundString(_ variable: Double) -> String {
if distance.contains(".") {
let formattedString = String(format: "%.3f", variable)
return formattedString
} else {
return distance
}
}
}
struct ContentView_Previews: PreviewProvider {

View file

@ -62,8 +62,8 @@ struct DocsView: View {
}
Section(header: Text("App Information")) {
NavigationLink("Software License", destination: LicenseView())
Text("Version: Prerelease Build LVSXT10a.3")
Text("Release date: 2022-06-15")
Text("Version: Release Candidate 3")
Text("Release date: 2022-06-16")
Text("Start date: 2022-03-25")
Link("Built with SwiftUI \(Image(systemName: "swift"))", destination: URL(string: "https://developer.apple.com/xcode/swiftui")!)
}

View file

@ -13,7 +13,7 @@ struct RecentlyResolved: View {
var body: some View {
ScrollView {
VStack(alignment: .leading) {
Text("\u{2022} Implemented an easy way to dismiss the keyboard in the main view of Calculator (it only took 2 1/2 months)\n\u{2022} Opening the contacts tab no longer causes the app to crash (RC 2)\n\u{2022} Typing zero as the first number for the distance no longer causes the app to crash")
Text("\u{2022} Opening the contacts tab no longer causes the app to crash\n\u{2022} Typing zero as the first number for the distance no longer causes the app to crash\n\u{2022} Having a distance of less than .1 no longer crashes the app")
}
.padding(30)
}
@ -25,9 +25,13 @@ struct HighPriority: View {
var body: some View {
ScrollView {
VStack {
Text("\u{2022} Entering a distance of less than 0.1 per unit causes the app to crash\n\t**Workaround:** RIP to you if this applies")
Image(systemName: "checkmark.shield.fill")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 70)
}
.padding(30)
.frame(maxWidth: .infinity)
}
.navigationTitle("High Priority")
}
@ -43,6 +47,7 @@ struct MediumPriority: View {
.frame(width: 70)
}
.padding(30)
.frame(maxWidth: .infinity)
}
.navigationTitle("Medium Priority")
}