How to let third-party enum confirm CasePathable #144
-
In latest version, the Seems not possible to add macro with @CasePathable
extension ThirdPartyEnum {} // Error: 'extension' macro cannot be attached to extension |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @marcuswu0814! It's not possible to apply a macro to define such a conformance, but it is possible to define it from scratch for types you don't own. For example, the library defines We also define a bunch of manual conformances in the Composable Architecture. |
Beta Was this translation helpful? Give feedback.
Hi @marcuswu0814! It's not possible to apply a macro to define such a conformance, but it is possible to define it from scratch for types you don't own. For example, the library defines
CasePathable
conformances for theOptional
andResult
types: https://github.com/pointfreeco/swift-case-paths/blob/main/Sources/CasePaths/Result%2BCasePathable.swiftWe also define a bunch of manual conformances in the Composable Architecture.