File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Sources/ComposableArchitecture/Effects Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -102,5 +102,21 @@ import ReactiveSwift
102
102
return producer. on ( disposed: task? . cancel)
103
103
}
104
104
}
105
+
106
+ /// Creates an effect that executes some work in the real world that doesn't need to feed data
107
+ /// back into the store.
108
+ ///
109
+ /// - Parameters:
110
+ /// - priority: Priority of the underlying task. If `nil`, the priority will come from
111
+ /// `Task.currentPriority`.
112
+ /// - work: A closure encapsulating some work to execute in the real world.
113
+ /// - Returns: An effect.
114
+ public static func fireAndForget(
115
+ priority: TaskPriority ? = nil ,
116
+ _ work: @escaping @Sendable ( ) async -> Void
117
+ ) -> Effect {
118
+ Effect < Void , Never > . task ( priority: priority) { await work ( ) }
119
+ . fireAndForget ( )
120
+ }
105
121
}
106
122
#endif
You can’t perform that action at this time.
0 commit comments