fix(macos): suppress Swift compiler warnings

Merged
QE
4d ago
+10-7

Summary

  • Replace unsafe force cast with unsafeDowncast in AXFocusOperations for proper type-safe handling of CFBoolean
  • Fix sendability warning in AXFrameCoordinator by reconstructing the application element locally instead of capturing it across async boundaries
  • Update closure syntax in MacOSPlatform+WindowSnapshotDiscovery to clarify closure scope
  • Replace unsafe String(cString:) with explicit null-terminator handling in WindowSnapshotRefreshPolicy to handle C strings safely

Testing

  • Swift build completes without warnings: python3 script/verify.py local
  • No functional behavior changes; warnings only

[!NOTE]

Fix Swift compiler warnings in DefiMacOS accessibility code

  • Removes a forced cast in AXFocusOperations.readFocused by using an unchecked downcast after the existing CF type-identifier check (AXFocusOperations.swift)
  • Fixes appBundleIdentifier(processID:) to decode the non-null portion of the proc_pidpath buffer as UTF-8, so bundle lookup gets a clean executable path (WindowSnapshotRefreshPolicy.swift)
  • Reworks the queued restoration closure in AXFrameCoordinator to capture the restoration token, recreate the application accessibility element from the process ID at execution time, and record failed restorations against that element (AXFrameCoordinator.swift)
  • Adds parentheses around a closure in the window-retry deadline check (MacOSPlatform+WindowSnapshotDiscovery.swift)

Macroscope summarized 50dce2d.