Skip to content

Instantly share code, notes, and snippets.

@adamdroberts
adamdroberts / Scan screen for Progress bar
Last active June 29, 2025 23:37
MacOS swift code to detect NSProgressIndicator on screen in any application
import Cocoa
import ApplicationServices
/// Traverses the view hierarchy of all windows associated with the current application
/// to find if any view is an NSProgressIndicator.
///
/// - Returns: `true` if at least one NSProgressIndicator is found, `false` otherwise.
@MainActor func findNativeProgressBarsInAllWindows() -> Bool {
// Get the shared application instance
let app = NSApplication.shared