Skip to content

Commit 1fa4d3c

Browse files
authored
Fix macOS 13 compatibility (#356)
## Summary - Replace `asyncAndWait` with `sync` to fix crash on macOS 13 ## Problem `DispatchQueue.asyncAndWait(execute:)` is only available on macOS 14+. Using `#available` check doesn't help because the symbol is still hard-linked in the binary, causing dyld to crash at launch on older systems: ``` Symbol not found: _$sSo17OS_dispatch_queueC8DispatchE12asyncAndWait7executexxyKXE_tKlF Expected in: /usr/lib/swift/libswiftDispatch.dylib ``` ## Solution Use `DispatchQueue.main.sync(execute:)` instead, which has equivalent behavior and is available on all macOS versions.
1 parent 4a3cb13 commit 1fa4d3c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/CodeEditSourceEditor/Extensions/DispatchQueue+dispatchMainIfNot.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extension DispatchQueue {
3131
if Thread.isMainThread {
3232
return item()
3333
} else {
34-
return DispatchQueue.main.asyncAndWait(execute: item)
34+
return DispatchQueue.main.sync(execute: item)
3535
}
3636
}
3737
}

0 commit comments

Comments
 (0)