Move the recording side effects into the RecordingViewModel view model in the Recording package target.

This commit is contained in:
2026-07-04 14:50:41 +02:00
parent 5e102f21e1
commit 702333038c
3 changed files with 97 additions and 124 deletions
@@ -5,7 +5,7 @@ import SwiftUI
/// The view shows a main button that starts, pauses, and resumes a recording, with a label above it displaying the elapsed recording time.
/// While paused, a send button lets the user submit the recording for processing, showing a progress indicator until the processing finishes.
///
/// All state and control behavior lives in the view's ``Model``; the view itself only renders it and forwards button presses and state changes.
/// All state and control behavior lives in the view's ``Model``; the view itself only renders it and forwards button presses.
public struct RecordingView: View {
// MARK: Properties
@@ -44,8 +44,8 @@ public struct RecordingView: View {
// MARK: Body
/// The content of the view: the timer label above the main and send buttons, with every change of the model's state forwarded back
/// to ``Model/updatedState(shouldRestartTimer:)``.
/// The content of the view: the timer label above the main and send buttons, with the transcription of every processed recording
/// forwarded to the closure given at initialization.
public var body: some View {
VStack(
spacing: Constant.Spacing.stack
@@ -98,14 +98,6 @@ public struct RecordingView: View {
}
}
}
.onChange(
of: model.state,
initial: false
) { oldValue, _ in
model.updatedState(
shouldRestartTimer: oldValue == .notRecording
)
}
.onChange(
of: model.transcription,
initial: false