Skip to content

Commit be74a9e

Browse files
committed
AppKit: specify main actors on NSViewRepresentable.
Signed-off-by: furby™ <devs@wabi.foundation>
1 parent 067e78e commit be74a9e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sources/AppKitBackend/NSViewRepresentable.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ where Content == Never {
1212
associatedtype Coordinator = Void
1313

1414
/// Create the initial NSView instance.
15+
@MainActor
1516
func makeNSView(context: NSViewRepresentableContext<Coordinator>) -> NSViewType
1617

1718
/// Update the view with new values.
@@ -20,12 +21,14 @@ where Content == Never {
2021
/// - context: The context, including the coordinator and potentially new environment
2122
/// values.
2223
/// - Note: This may be called even when `context` has not changed.
24+
@MainActor
2325
func updateNSView(_ nsView: NSViewType, context: NSViewRepresentableContext<Coordinator>)
2426

2527
/// Make the coordinator for this view.
2628
///
2729
/// The coordinator is used when the view needs to communicate changes to the rest of
2830
/// the view hierarchy (i.e. through bindings), and is often the view's delegate.
31+
@MainActor
2932
func makeCoordinator() -> Coordinator
3033

3134
/// Compute the view's size.

0 commit comments

Comments
 (0)