A lot of credit was given recently to new Protocol-Oriented Programming, however, I would like to show my own example and to share the experience.

One fine day I got an amusing task the aim of which was to implement the feature like changing view appearance. It can be shape, shadows or something else, everything depends on design requirements. In my particular case, it had to look like this.

Once I got a very unusual task for me. Along with finding the reasonable solution, I worried about the feasibility of it, since I couldn’t resolve this with a cut and dried scenario. So what exactly did I have to do?