Skip to content

Commit

Permalink
Add MainActor annotations to RefreshCommand (#875)
Browse files Browse the repository at this point in the history
Fixes #666 when using Xcode 16 RC.
  • Loading branch information
bolsinga authored Sep 10, 2024
1 parent d986670 commit eadc9ab
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Sources/Site/Music/UI/RefreshCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ import SwiftUI

#if !os(tvOS)
public struct RefreshCommand: Commands, Sendable {
let refreshAction: (@Sendable () async -> Void)
private let refreshAction: (@MainActor @Sendable () async -> Void)

public init(refreshAction: (@escaping @Sendable () async -> Void)) {
public init(refreshAction: (@escaping @MainActor @Sendable () async -> Void)) {
self.refreshAction = refreshAction
}

public var body: some Commands {
CommandGroup(after: .newItem) {
Button {
Task { await refreshAction() }
Task { @MainActor in
await refreshAction()
}
} label: {
Text("Refresh", bundle: .module)
}
Expand Down

0 comments on commit eadc9ab

Please sign in to comment.