This is what my code is looking like:
import SwiftUI
struct dummy: View {
var job: Job
@ObservedObject var jobViewModel: JobViewModel
var body: some View {
Text("Placeholder for job details, will not exists in production, please delete")
VStack(alignment: .leading){
HStack{
Text("Boat Name")
Spacer()
.frame(width: 50, height: 50)
Text(job.boatName)
}
/*HStack{
Text("Job Time")
Spacer()
.frame(width: 50, height: 50)
Text(jobTime)
}*/
HStack{
Text("Job Type")
Spacer()
.frame(width: 50, height: 50)
Text(job.job)
}
HStack{
Text("Owner's Name")
Spacer()
.frame(width: 50, height: 50)
Text(job.ownerName)
//Text(job.time)
}
Button("Complete Job"){
jobViewModel.complete(job)
}.frame(width: 200)
}
}
}
/*struct dummy_Previews: PreviewProvider {
static var previews: some View {
dummy(job: Job[0])
}
}*/
//foundout to get rid of this from below:
//https://medium.com/swift-productions/create-list-navigation-using-swiftui-c63534355fb1
//If i didn't get rid of it, it would case issues
If I keep out the "PreviewProvider" it works, If i keep it in, it throws errors. I am building directly to a device every time I try the app. Do I need this so the ObservedObject works?