This is far more compact and simplified, but I'm not going to merge this as-is because it makes up a segment of my recipes that also needs to be updated, with the code described there-in, to match this example. I'm going to hold on to your suggestion, and I'll re-work the UIKit example in the recipes section.
Also I tend to not use the $0 and $1 implicit variable de-structuring forms, especially when writing something to be consumed by others - because while it's obvious to some folks, I've found a number of folks - especially those just getting started and learning - kind find the references to be much harder to understand.
I do like your idea of returning Bool's from the two publisher forms, rather than values - it simplifies the example significantly. When I first wrote it, I was experimenting, so there's a lot of extra safety catches and "smaller steps". I think I was intending to use those values - but I guess I never did, ah well.
Thanks @tonnylitao -
This is far more compact and simplified, but I'm not going to merge this as-is because it makes up a segment of my recipes that also needs to be updated, with the code described there-in, to match this example. I'm going to hold on to your suggestion, and I'll re-work the UIKit example in the recipes section.
Also I tend to not use the
$0
and$1
implicit variable de-structuring forms, especially when writing something to be consumed by others - because while it's obvious to some folks, I've found a number of folks - especially those just getting started and learning - kind find the references to be much harder to understand.I do like your idea of returning Bool's from the two publisher forms, rather than values - it simplifies the example significantly. When I first wrote it, I was experimenting, so there's a lot of extra safety catches and "smaller steps". I think I was intending to use those values - but I guess I never did, ah well.
The PR changes are a good suggestion - thank you.