# Extract Payload for enum cases having associated value

**URL:** <https://forums.swift.org/t/extract-payload-for-enum-cases-having-associated-value/27606>\
**Category:** Pitches\
**Tags:** enums, associatedvalue\
**Created:** [August 4, 2019, 4:16pm UTC](https://forums.swift.org/t/extract-payload-for-enum-cases-having-associated-value/27606 "2019-08-04T16:16:24Z")\
**Posts on this page:** 1\
**Showing post:** 146

<div class="post-metadata">

**Author:** ![stephencelis](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/stephencelis/32/2675_2.png) [@stephencelis](https://forums.swift.org/u/stephencelis)\
**Post date:** [August 21, 2019, 6:12pm UTC](https://forums.swift.org/t/extract-payload-for-enum-cases-having-associated-value/27606/146 "2019-08-21T18:12:45Z")

</div>

To provide a more real-world example, we covered a compelling reason for enum key paths/properties this week on Point-Free:

> **[Episode #70: Composable State Management: Action Pullbacks](https://www.pointfree.co/episodes/ep70-composable-state-management-action-pullbacks)**
>
> Turns out, reducers that work on local actions can be \_pulled back\_ to work on global actions. However, due to an imbalance in how Swift treats enums versus structs it takes a little work to implement. But never fear, a little help from our old...

Though this video is behind a paywall, our code is always open source:

> <https://github.com/pointfreeco/episode-code-samples/blob/master/0070-composable-state-management-action-pullbacks/ComposableArchitecture.playground/Contents.swift>

In particular we show how reducer architecture can be modularized and reconstituted using a couple succinct operations:

1. An operation that converts `Reducer<LocalState, LocalAction>` to `Reducer<GlobalState, GlobalAction>`
2. An operation that combines reducers that work on the same state and action type together

The first operation cannot succinctly transform `LocalAction`s into `GlobalAction`s in a performant manner without compiler help and enum properties and key paths perfectly handle this today (with a little boilerplate that ideally the compiler handles for us).

---

_[View the full topic](https://forums.swift.org/t/extract-payload-for-enum-cases-having-associated-value/27606)._
