Composable Analytics #2105
oliverfoggin
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A while ago there were some discussions on Slack around how to approach analytics in a TCA app.
It could be done naively by just allowing each reducer to send analytics per action etc... and grabbing hold of a dependency to send it through etc...
But, I wanted a way that means...
So, I came up with the idea of using an
AnalyticsReducer
to do all the work for you. TheAnalyticsReducer
is created with a trailing closure of the form(State, Action) -> AnalyticsData?
so is very similar to the normalReducer
way of working exceptState
is notinout
so can't be mutated.The short version of what it looks like to use it is something like this...
Anyway, I just put it on GitHub for anyone else to use... https://github.com/oliverfoggin/swift-composable-analytics
Any comments or contributions are welcome.
Thanks 😄
Beta Was this translation helpful? Give feedback.
All reactions