split views into subview
This commit is contained in:
54
iphone/Werkout_ios/subview/CaloriesBurnedView.swift
Normal file
54
iphone/Werkout_ios/subview/CaloriesBurnedView.swift
Normal 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()
|
||||
//}
|
||||
Reference in New Issue
Block a user