split views into subview

This commit is contained in:
Trey t
2024-06-18 14:31:27 -05:00
parent 7d2b6b3e6e
commit 48cc22b3e2
7 changed files with 226 additions and 136 deletions

View File

@@ -0,0 +1,54 @@
//
// CaloriesBurnedView.swift
// Werkout_ios
//
// Created by Trey Tartt on 6/18/24.
//
import SwiftUI
struct CaloriesBurnedView: View {
@Binding var healthKitWorkoutData: HealthKitWorkoutData?
let calsBurned: Double
var body: some View {
VStack {
HStack {
HStack {
Image(systemName: "flame.fill")
.foregroundColor(.orange)
.font(.title)
VStack {
Text("\(calsBurned, specifier: "%.0f")")
}
}
.frame(maxWidth: .infinity)
}
if let minHeart = healthKitWorkoutData?.minHeartRate,
let maxHeart = healthKitWorkoutData?.maxHeartRate,
let avgHeart = healthKitWorkoutData?.avgHeartRate {
VStack {
HStack {
Image(systemName: "heart")
.foregroundColor(.red)
.font(.title)
VStack {
HStack {
Text("\(minHeart, specifier: "%.0f")")
Text("-")
Text("\(maxHeart, specifier: "%.0f")")
}
Text("\(avgHeart, specifier: "%.0f")")
}
}
}
.frame(maxWidth: .infinity)
}
}
}
}
//#Preview {
// CaloriesBurnedView()
//}