Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dismiss with transaction #2433

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Sources/ComposableArchitecture/Dependencies/Dismiss.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ public struct DismissEffect: Sendable {
animation: Animation?,
fileID: StaticString = #fileID,
line: UInt = #line
) async {
await callAsFunction(transaction: Transaction(animation: animation))
}

@MainActor
public func callAsFunction(
transaction: Transaction,
fileID: StaticString = #fileID,
line: UInt = #line
) async {
guard let dismiss = self.dismiss
else {
Expand All @@ -104,7 +113,7 @@ public struct DismissEffect: Sendable {
)
return
}
withAnimation(animation) {
withTransaction(transaction) {
dismiss()
}
}
Expand Down