Skip to content
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

Add Swift macro (requires Swift v5.9) #58

Merged
merged 12 commits into from
Mar 15, 2024

Conversation

tinder-cfuller
Copy link
Collaborator

The added Swift macro provides StateMachineHashable conformance automatically for Swift version 5.9 and above.

Code Example:

@StateMachineHashable
indirect enum State {

     case locked(credit: Int), unlocked, broken(oldState: State)
}

@StateMachineHashable
enum Event {

     case insertCoin(Int), admitPerson, machineDidFail, machineRepairDidComplete
}

Older Swift versions will still require boilerplate implementation for State or Event enumerations defined with associated values – so that information remains in the README.

Copy link

@tinder-danielhall tinder-danielhall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very very cool! Excellent work, Chris! I left a few comments for consideration 👍

@tinder-cfuller tinder-cfuller merged commit 00ee8f4 into Tinder:main Mar 15, 2024
1 check passed
@tinder-cfuller tinder-cfuller deleted the swift-macro branch March 15, 2024 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants