This is a really cool presentation where the authors "step up the ladder" to design a really elegant API for animations as semirings (where * is used to sequence animations, and + for animations running in parallel), and then go on to implement it in Swift:
https://bkase.github.io/slides/algebra-driven-design/