Lets say I have a struct state like this
struct SomeState: Equatable {
var counter: Int = 0
var foo: Bool = false
}
and then a subject of private let _state = CurrentValueSubject(SomeState())
I know I can update it as _state.value.counter += 1
Is this however thread-safe in a concurrent context? Will any write wait for the previous one? Or will there be some state smashing? I'm not sure how this works under the hood in swift, I'm coming from kotlin