Skip to content

Commit 18b4e65

Browse files
committed
Resolve warning by not capturing self in detached task
1 parent 88e9606 commit 18b4e65

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/ComposableArchitecturePattern/AsyncButton.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public struct AsyncButton<Label: View>: View {
4747

4848
public var body: some View {
4949
Button {
50+
let action = self.action
51+
5052
if self.detachTask {
5153
Task.detached {
52-
await self.action()
54+
await action()
5355
}
5456
} else {
5557
self.state = .idle

0 commit comments

Comments
 (0)