This PR improves the stability and maintainability of VSM by fixing some bugs and providing clean protocols for the state container. (These protocols are also preparatory for the VSM property wrappers implementation which will follow shortly.)
Items of consequence in this PR:
Fixed a bug where the iOS runtime was confusing synchronous closures with asynchronous closures, causing various timing issues. The fix entails renaming observe(_ awaitState: () async -> State) to observeAsync(_ awaitState: () async -> State)
Fixed a bug where the StateContainer was not updating the state synchronously on the main thread if both the subscription and the publisher's send function were being invoked on the main thread. This was causing various timing issues. (Added unit tests to prevent future regression)
Added StateContaining, StateObserving, StateBinding, and StatePublishing protocols to pave the way for the incoming VSM property wrappers.
Updated the debug functions and implementation to work more predictably, have more intuitive spelling, and have advanced options for more easily identifying state progression bugs in feature code.
Description
This PR improves the stability and maintainability of VSM by fixing some bugs and providing clean protocols for the state container. (These protocols are also preparatory for the VSM property wrappers implementation which will follow shortly.)
Items of consequence in this PR:
observe(_ awaitState: () async -> State)
toobserveAsync(_ awaitState: () async -> State)
StateContaining
,StateObserving
,StateBinding
, andStatePublishing
protocols to pave the way for the incoming VSM property wrappers.Type of Change
Checklist