pointfreeco / swift-case-paths

🧰 Case paths extends the key path hierarchy to enum cases.
https://www.pointfree.co/collections/enums-and-structs/case-paths
MIT License
907 stars 105 forks source link

Support enums with cases wrapped in #if #133

Closed AndrewVebster closed 9 months ago

AndrewVebster commented 9 months ago

Summary

This PR updates the macro code to allow it to generate case paths for cases which are conditionally compiled. For example:

@CasePathable enum Foo {
  case bar
  #if DEBUG
  case debugCase
  #endif
}

Currently released implementation would generate the case path only for bar.

Why

I'm working on a project where we use TCA. Because we share the code between iOS and macOS we have a few places where one platform has some additional actions (features) and they are wrapped with #if os.

What do you think? Would it be useful? Appreciate any feedback 🙂

AndrewVebster commented 9 months ago

Happy to contribute 😉 🙌