Xcode 13.4.1 Monterey でAXIsProcessTrustedWithOptionsが使えなくなった。
NSEventに入れているのに反応しなくなった
その後、 ボタンを追加して手動でAXIsProcessTrustedWithOptionsを試したがうまく動かずで 調べてみると↓
↓ここ
I realized this is an Xcode bug instead. This is caused if the SwiftUI preview provider is run concurrently with the actual build, this causes some confusion with the accessibility permissions with macOS.
↑が書いていて
rm -rf ~/Library/Developer/Xcode/DerivedData
↑キャッシュの中身を消して Xcodeを再起動したら動いた