Summing up with the template method pattern

The template method pattern in Swift is particularly well implemented with protocols and extensions. Protocols let you efficiently abstract algorithms, their implementations relying on the requirements defined by the protocols themselves.

As we've seen, this pattern is particularly useful when only parts of an algorithm is dynamic and those changes can or should be deferred to subclasses and have no effect on the overall algorithm.