Fix numerous concurrency warnings.

This commit is contained in:
Brent Simmons
2024-03-24 12:37:55 -07:00
parent 0f639085d6
commit c01e2d1682
5 changed files with 11 additions and 12 deletions

View File

@@ -10,7 +10,7 @@ import AppKit
public extension NSPasteboard {
func copyObjects(_ objects: [Any]) {
@MainActor func copyObjects(_ objects: [Any]) {
guard let writers = writersFor(objects) else {
return
@@ -54,7 +54,7 @@ public extension NSPasteboard {
private extension NSPasteboard {
func writersFor(_ objects: [Any]) -> [NSPasteboardWriting]? {
@MainActor func writersFor(_ objects: [Any]) -> [NSPasteboardWriting]? {
let writers = objects.compactMap { ($0 as? PasteboardWriterOwner)?.pasteboardWriter }
return writers.isEmpty ? nil : writers

View File

@@ -10,6 +10,6 @@ import AppKit
public protocol PasteboardWriterOwner {
var pasteboardWriter: NSPasteboardWriting { get }
@MainActor var pasteboardWriter: NSPasteboardWriting { get }
}
#endif