The alignmentGuide modifier is @preconcurrency nonisolated. In Swift 6, I had to call a nonisolated function to calculate alignment, in which a certain @MainActor property was needed. That's why I tried to use a semaphore. I have switched back to Swift 5, since AVFoundation is not ready for Swift 6. The problem here is solved by removing nonisolated and semaphore. We may handle it after switching to Swift 6 in the future. Thanks.