I'm reading the Apple document, but I don't understand it.
If you do this,
// Temperature now: 20.0
// Temperature now:25.0
It says, but why is 20.0?
After generating the Weather class, that is, the temperature has already entered and the publisher is registered afterwards, so
I don't think the publisher will work for 20, but it will actually output 20.
Please let me know if you understand.swift swiftui combine
I guess weather.temperature is the CurrentValueSubject.
Subject|Apple Developer Documentation
The expected behavior seems to be from another subject, PassthroughSubject.
© 2022 OneMinuteCode. All rights reserved.