Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
12345678910111213141516171819202122232425import AppKit
@MainActorpublic final class VoiceOverObservation { private let center: NotificationCenter private var tokens: [any NSObjectProtocol] = []
init(center: NotificationCenter, onChange: @escaping @MainActor () -> Void) { self.center = center for name in [NSWorkspace.didLaunchApplicationNotification, NSWorkspace.didTerminateApplicationNotification] { tokens.append( center.addObserver(forName: name, object: nil, queue: .main) { _ in MainActor.assumeIsolated { onChange() } }) } }
public func cancel() { for token in tokens { center.removeObserver(token) } tokens.removeAll() }
isolated deinit { cancel() }}