[ad_1]
I might wish to be notified the second all Mix publishers have performed their work like DispatchGroup and .notify do.
For instance, on the beneath codes, I wish to present ProgressView whereas publishers(pub1, pub2) doing their job.
import Mix
import Basis
import SwiftUI
struct SwiftUIView: View {
@State var isFinished = false
let pub1 = ["one", "two", "three", "four"].writer
let pub2 = ["five", "six", "seven", "eight"].writer
var subscriptions = Set<AnyCancellable>()
var physique: some View {
if isFinished {
Textual content("Howdy, World!")
} else {
ProgressView()
}
}
init() {
pub1
.sink { print($0) }
.retailer(in: &subscriptions)
pub2
.sink { print($0) }
.retailer(in: &subscriptions)
// The place ought to I write this code?
// isFinished = true
}
}
My query is that how can I wait till publishers end and present “Howdy world” on the proper time?
Is there something I ought to know? In that case, please let me know. Thanks!
[ad_2]
