Pick the fix
An auth service must tell screens whether the user is signed in, including screens created later. Which subject?
Hint 1 of 1
What does a late subscriber need to see?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A CurrentValueSubject<Bool, Never>, exposed as AnyPublisher
Correct. New subscribers get the current state at once.
Why not the others?
- B PassthroughSubject<Bool, Never>. Screens created later miss the last value until the next change.
- C Just(true). Just emits one fixed value and finishes.
- D Future. A Future emits a single value once; sign-in state changes over time.