Today let’s talk about setters! So, the problem is that in our applications we often come across complicated, deeply nested data structures, and we want to be able to modify parts of those structures while keeping everything else fixed. Further, we wanna be able to do it a simple, clean, composable way, where “composable” means that if we have two ways of modify parts of a structure, I should be able to combine them into one thing that modifies both of those parts at the same time.
Let’s look at something simple enough:
let pair = (42, "Swift")