// TempoSyncRevision.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT import Observation /// An observable revision counter bumped whenever a pedal's ``Pedal/tempoSync`` state changes. /// /// ``Pedal/tempoSync`` is a plain dictionary, not observable, so a SwiftUI view showing the sync /// state (the note-division badge) needs a signal to re-render when the state changes through any /// path — the knob's own picker, a preset load, or a lightweight recall. Reading ``value`` inside a /// view body subscribes it; ``Pedal/setSync(_:for:)`` and `Pedal.applyState(_:)` bump it. @Observable public final class TempoSyncRevision { /// Incremented on every ``Pedal/tempoSync`` mutation. Its magnitude is meaningless — only the /// change matters, as an invalidation signal for observing views. public internal(set) var value: Int = 0 /// Creates a revision counter starting at zero. public init() {} /// Bumps the counter, invalidating any view observing ``value``. func bump() { value &+= 1 } }