Skip to content

Commit 0e10077

Browse files
committed
update
1 parent 7380d83 commit 0e10077

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Sources/async-task/protocol/IAsyncTask.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public protocol IAsyncTask: AnyObject, Sendable {
7474
/// - priority: The priority of the task, which determines its scheduling priority in the system.
7575
/// - operation: A closure that performs an asynchronous task and returns
7676
/// a value of type `Value` upon completion. The closure can throw an error if the task fails.
77-
func start(priority: TaskPriority?, operation: @escaping Async.Producer<Value>)
77+
func start(priority: TaskPriority?, operation: @escaping Async.Producer<Value?>)
7878

7979
/// Starts an asynchronous operation with a specified input.
8080
///
@@ -86,7 +86,7 @@ public protocol IAsyncTask: AnyObject, Sendable {
8686
/// - priority: The priority of the task, which determines its scheduling priority in the system.
8787
/// - operation: A closure that takes an input of type `I`, performs an asynchronous task, and
8888
/// returns a value of type `Value` upon completion. The closure can throw an error if the task fails.
89-
func start<I: Sendable>(with input: I, priority: TaskPriority?, operation: @escaping Async.Mapper<I, Value>)
89+
func start<I: Sendable>(with input: I, priority: TaskPriority?, operation: @escaping Async.Mapper<I, Value?>)
9090

9191
/// Executes an asynchronous operation and manages its lifecycle.
9292
///
@@ -100,7 +100,7 @@ public protocol IAsyncTask: AnyObject, Sendable {
100100
///
101101
/// - Note: Ensures thread safety by running on the main actor, making it suitable for managing
102102
/// UI-related tasks or state changes.
103-
func startTask(priority: TaskPriority?, _ operation: @escaping Async.Producer<Value>)
103+
func startTask(priority: TaskPriority?, _ operation: @escaping Async.Producer<Value?>)
104104
}
105105

106106
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
@@ -119,7 +119,7 @@ extension IAsyncTask {
119119
///
120120
/// - Note: Ensures all updates occur on the main actor, making it safe for use in UI-related contexts.
121121
@MainActor
122-
public func start(priority: TaskPriority? = nil, operation: @escaping Async.Producer<Value>) {
122+
public func start(priority: TaskPriority? = nil, operation: @escaping Async.Producer<Value?>) {
123123
startTask(priority: priority) {
124124
try await operation()
125125
}
@@ -139,7 +139,7 @@ extension IAsyncTask {
139139
/// - operation: A closure that takes an input of type `I`, performs an asynchronous task, and
140140
/// returns a value of type `Value` upon completion. The closure can throw an error if the task fails.
141141
@MainActor
142-
public func start<I: Sendable>(with input: I, priority: TaskPriority? = nil, operation: @escaping Async.Mapper<I, Value>) {
142+
public func start<I: Sendable>(with input: I, priority: TaskPriority? = nil, operation: @escaping Async.Mapper<I, Value?>) {
143143
startTask(priority: priority) {
144144
try await operation(input)
145145
}

Sources/async-task/task/ObservableSingleTask.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extension Async {
1616
@Observable
1717
@available(iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0, *)
1818
public final class ObservableSingleTask<V: Sendable, E: Error>: IAsyncTask {
19-
19+
2020
// MARK: - Public Properties
2121

2222
/// The error encountered during the task, if any.
@@ -72,7 +72,7 @@ extension Async {
7272
/// The closure can throw an error if the task fails.
7373
public func startTask(
7474
priority: TaskPriority? = nil,
75-
_ operation: @escaping Producer<V>
75+
_ operation: @escaping Producer<V?>
7676
) {
7777
cancel()
7878
clean()

Sources/async-task/task/SingleTask.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ extension Async {
7777
/// UI-related tasks or state changes.
7878
public func startTask(
7979
priority: TaskPriority? = nil,
80-
_ operation: @escaping Producer<V>
80+
_ operation: @escaping Producer<V?>
8181
) {
8282
cancel()
8383
clean()

0 commit comments

Comments
 (0)