Skip to content

Commit

Permalink
reset content and dismiss after partial sheet is closed.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaMiotto committed May 10, 2020
1 parent 1d6c1ba commit 209895f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Sources/PartialSheet/PartialSheetManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ import SwiftUI
public class PartialSheetManager: ObservableObject {

/// Published var to present or hide the partial sheet
@Published var isPresented: Bool = false
@Published var isPresented: Bool = false {
didSet {
if !isPresented {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) { [weak self] in
self?.content = AnyView(EmptyView())
self?.onDismiss = nil
}
}
}
}
/// The content of the sheet
private(set) var content: AnyView
/// the onDismiss code runned when the partial sheet is closed
Expand Down

0 comments on commit 209895f

Please sign in to comment.