Skip to content

Commit 0e0b7c3

Browse files
committed
Update LoopPlayerMultiPlatform.swift
1 parent f0d5aa2 commit 0e0b7c3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/swiftui-loop-videoplayer/view/loop/main/LoopPlayerMultiPlatform.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extension LoopPlayerMultiPlatform: UIViewRepresentable{
6767
/// Creates the container view with the player view and error view if needed
6868
/// - Parameter context: The context for the view
6969
/// - Returns: A configured UIView
70-
func makeUIView(context: Context) -> UIView {
70+
@MainActor func makeUIView(context: Context) -> UIView {
7171
let container = UIView()
7272

7373
if let player: PlayerView = makePlayerView(
@@ -85,7 +85,7 @@ extension LoopPlayerMultiPlatform: UIViewRepresentable{
8585
/// - Parameters:
8686
/// - uiView: The UIView to update
8787
/// - context: The context for the view
88-
func updateUIView(_ uiView: UIView, context: Context) {
88+
@MainActor func updateUIView(_ uiView: UIView, context: Context) {
8989
uiView.subviews.filter { $0 is ErrorView }.forEach { $0.removeFromSuperview() }
9090

9191
updateView(uiView, error: error)
@@ -98,7 +98,7 @@ extension LoopPlayerMultiPlatform: NSViewRepresentable{
9898
/// Creates the NSView for the representable component. It initializes the view, configures it with a player if available, and adds an error view if necessary.
9999
/// - Parameter context: The context containing environment and state information used during view creation.
100100
/// - Returns: A fully configured NSView containing both the media player and potentially an error message display.
101-
func makeNSView(context: Context) -> NSView {
101+
@MainActor func makeNSView(context: Context) -> NSView {
102102
let container = NSView()
103103

104104
if let player: PlayerView = makePlayerView(
@@ -116,7 +116,7 @@ extension LoopPlayerMultiPlatform: NSViewRepresentable{
116116
/// - Parameters:
117117
/// - nsView: The NSView that needs updating.
118118
/// - context: The context containing environment and state information used during the view update.
119-
func updateNSView(_ nsView: NSView, context: Context) {
119+
@MainActor func updateNSView(_ nsView: NSView, context: Context) {
120120
nsView.subviews.filter { $0 is ErrorView }.forEach { $0.removeFromSuperview() }
121121

122122
updateView(nsView, error: error)

0 commit comments

Comments
 (0)