Skip to content

Commit

Permalink
fixes #1: make Value conform to Sendable
Browse files Browse the repository at this point in the history
  • Loading branch information
lukepistrol committed Sep 20, 2023
1 parent 714fd78 commit fc28752
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ let package = Package(
products: [
.library(
name: "TaskTrigger",
targets: ["TaskTrigger"]),
targets: ["TaskTrigger"]
),
],
targets: [
.target(
name: "TaskTrigger"),
name: "TaskTrigger"
),
]
)
2 changes: 1 addition & 1 deletion Sources/TaskTrigger/TaskTrigger.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftUI

public struct TaskTrigger<Value: Equatable>: Equatable {
public struct TaskTrigger<Value: Equatable>: Equatable where Value: Sendable {

internal enum TaskState<T: Equatable>: Equatable {
case none
Expand Down
2 changes: 1 addition & 1 deletion Sources/TaskTrigger/TaskTriggerViewModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import SwiftUI

struct TaskTriggerViewModifier<Value: Equatable>: ViewModifier {
struct TaskTriggerViewModifier<Value: Equatable>: ViewModifier where Value: Sendable {

typealias Action = @Sendable (_ value: Value) async -> Void

Expand Down
2 changes: 1 addition & 1 deletion Sources/TaskTrigger/View+Task.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public extension View {
func task<Value: Equatable>(
_ trigger: Binding<TaskTrigger<Value>>,
_ action: @escaping @Sendable @MainActor (_ value: Value) async -> Void
) -> some View {
) -> some View where Value: Sendable {
modifier(TaskTriggerViewModifier(trigger: trigger, action: action))
}

Expand Down

0 comments on commit fc28752

Please sign in to comment.