Files
workouts/Workouts/ContentView.swift
T
rzen 586804f771 Add the Library tab: reorderable routines pane and searchable grouped exercises pane
A fourth tab promotes routine and exercise management out of Settings.
LibraryView switches between two segments on one navigation stack. The
routines pane (RoutineListView reborn as RoutinesLibraryView) sorts by
the user's order, gains drag-to-reorder writing only changed orders,
swipe actions for duplicate/edit/delete, a Starter badge on bundled
seeds, and a last-trained caption. The exercises pane groups the library
into curated category sections searchable by name, category, or muscle.

Claude-Session: https://claude.ai/code/session_01H8VxUX4ckjU3vRF5M4L5FV
2026-07-15 10:58:57 -04:00

44 lines
1.4 KiB
Swift

//
// ContentView.swift
// Workouts
//
// Copyright 2025 Rouslan Zenetl. All Rights Reserved.
//
import SwiftUI
struct ContentView: View {
@Environment(LiveRunState.self) private var liveRun
var body: some View {
TabView {
Tab("Today", systemImage: "sun.max.fill") {
TodayView()
}
Tab("Progress", systemImage: "chart.line.uptrend.xyaxis") {
ProgressTabView()
}
Tab("Library", systemImage: "books.vertical.fill") {
LibraryView()
}
Tab("Settings", systemImage: "gearshape.2") {
SettingsView()
}
}
// Prop the phone up and it runs the live Apple Watch workout — two-way: drive from
// either device and the other follows.
.fullScreenCover(isPresented: Binding(
get: { liveRun.presentable != nil },
set: { presenting in if !presenting { liveRun.mute() } }
)) {
if let frame = liveRun.presentable {
// Re-key on the followed log so a flow-mode auto-advance (the driver
// moving to the next exercise) rebuilds the mirror for the new exercise
// instead of leaving a stale one pinned to the previous log.
LiveRunCoverView(frame: frame) { liveRun.mute() }
.id(frame.logID)
}
}
}
}