-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
suggestion on transition and condition, which should include Event #34
Comments
For example: .Pending State .LoadAction event has an associate integer to suggest which task it wants to trigger. when the .LoadAction triggered, and the machine on .Loading state with the same associate number, then the Event should be ignored. |
Hi, I added your above example as a XCTestCase in cc6bc8f. |
Yes. Because transition has no information on event, we should add all possible events to the machine.
if then the StateMachine cannot work on this kind of situations. |
Oh, OK I got it! I think it should be something like: typealias ConditionContext = (event: Event, transition: Transition, userInfo: Any?)
typealias Condition = ConditionContext -> Bool And for this enhancement, we will need a major version bump. |
Yes! Thanks! |
And another suggestion is, can you use Optional.None to represent the meaning of AnyState or AnyEvent? If there is a place needs nil to represent for the meaning of "AnyState" or "AnyEvent", just put "Event?" or "State?" as the parameter's type. |
Thanks for above feedback as well! |
Thanks:) |
Sorry for late reply. Please check and tell me your thoughts 😉 |
This issue has been completed in #36 and ver 4.0.0. @frogcjn Thanks again for your contribution! 🎉 |
There is a case that the event has associate values which cannot be enumerated all the possible values, so that it is not possible to add all Event Route into State Machine.
In this case, the only way to do it is to use condition.
But unfortunately, condition only includes transition which has no information about the event.
So I suggest to add Event information into transition.
The text was updated successfully, but these errors were encountered: