Initial Commit
This commit is contained in:
commit
15389248af
17 changed files with 1131 additions and 0 deletions
115
Splits/ModalView.swift
Normal file
115
Splits/ModalView.swift
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
//
|
||||
// ModalView.swift
|
||||
// Splits
|
||||
//
|
||||
// Created by Isaac Greene on 4/3/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import RichTextView
|
||||
|
||||
struct ModalView: View {
|
||||
@State var showSheet2 = false
|
||||
var body: some View {
|
||||
Text("Help")
|
||||
.font(.largeTitle)
|
||||
.bold()
|
||||
.padding(.top, 40)
|
||||
Text("Due to limitations in our system, you can only use kilometers and miles at this time. \nSmaller units like meters and feet are not supported. \nYou can, however, use decimals, such as .2km or .8mi.\n\nWe apologize for any inconvenience. In the future, we hope to make our app easier to use.")
|
||||
.padding()
|
||||
Button("See our math", action: {
|
||||
self.showSheet2.toggle()
|
||||
})
|
||||
.padding(30)
|
||||
.sheet(isPresented: self.$showSheet2, content: {
|
||||
SubSubView()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
struct SubView: View {
|
||||
@State var showSheet2 = false
|
||||
var body: some View {
|
||||
Text("Help")
|
||||
.font(.largeTitle)
|
||||
.bold()
|
||||
.padding(.top, 40)
|
||||
Text("Due to limitations in our system, you can only use kilometers and miles at this time. \nSmaller units like meters and feet are not supported. \nYou can, however, use decimals, such as .2km or .8mi.\n\nWe apologize for any inconvenience. In the future, we hope to make our app easier to use.")
|
||||
.padding()
|
||||
Button("See our math", action: {
|
||||
self.showSheet2.toggle()
|
||||
})
|
||||
.padding(30)
|
||||
.sheet(isPresented: self.$showSheet2, content: {
|
||||
SubSubView()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
struct SubSubView: View {
|
||||
|
||||
var body: some View {
|
||||
Text("The Algorithm")
|
||||
.font(.largeTitle)
|
||||
.bold()
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
Text("Calculating pace is fairly straightforward, and does not change with increased complexity. The standard formula is simply this:\n")
|
||||
mathView()
|
||||
.frame(maxHeight: 300)
|
||||
Text("\nWhere:\n")
|
||||
HStack {
|
||||
Text("\"t\"")
|
||||
.font(.custom("Charter", size: 18))
|
||||
Text("is total time")
|
||||
}
|
||||
HStack{
|
||||
Text("\"d\"")
|
||||
.font(.custom("Charter", size: 18))
|
||||
Text("is distance")
|
||||
}
|
||||
HStack {
|
||||
Text("\"p\"")
|
||||
.font(.custom("Charter", size: 18))
|
||||
Text("is the resulting pace")
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
struct mathView: View {
|
||||
@State var mathString:String = "[math] \\frac{t}{d} &= p [/math]"
|
||||
|
||||
var body: some View {
|
||||
mathLaTeX_inator(mathString: $mathString)
|
||||
.padding(30)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct mathLaTeX_inator: UIViewRepresentable {
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
@Binding var mathString:String
|
||||
|
||||
func makeUIView(context: Context) -> RichTextView {
|
||||
let richTextView = RichTextView(
|
||||
input: mathString,
|
||||
latexParser: LatexParser(),
|
||||
font: UIFont.systemFont(ofSize: UIFont.systemFontSize),
|
||||
textColor: (colorScheme == .dark ? UIColor.white : UIColor.black),
|
||||
frame: CGRect.zero,
|
||||
completion: nil
|
||||
)
|
||||
return richTextView
|
||||
}
|
||||
|
||||
func updateUIView(_ uiView: RichTextView, context: Context) {
|
||||
uiView.update(
|
||||
input: mathString,
|
||||
latexParser: LatexParser(),
|
||||
font: UIFont.systemFont(ofSize: UIFont.systemFontSize),
|
||||
textColor: (colorScheme == .dark ? UIColor.white : UIColor.black),
|
||||
completion: nil
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue