I have a Swift Combine question. Let’s say I have an ObservableObject with a few properties like this:
class AppState: ObservableObject{
static let shared = AppState()
@Published var a: Object?
@Published var b: Object?
@Published var c = [Object]()
}
I know I can be notified if a single object changes like this:
myCancellable = AppState.shared.$a.sink { a in
//Object 'a' changed
}
But is there a way to watch multiple properties and respond if any of them change?
Something like:
myCancellable = AppState.shared.[$a, $b, $c].sink { a, b, c in
//Objects 'a', 'b', or 'c' changed
}