Move the recording side effects into the RecordingViewModel view model in the Recording package target.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user