concept pat in category swift

appears as: PATs, PAT
Swift in Depth

This is an excerpt from Manning's book Swift in Depth.

Protocols are abstract as they are, but with PATs, you’re making your protocols generic, which makes your code even more abstract and exponentially complex.

Wielding PATs is a useful skill to have. It’s one thing to hear about them, nod, and think that they may be useful for your code one day. But I aim to make you understand PATs profoundly and feel comfortable with them, so that at the end of this section, PATs don’t intimidate you, and you feel ready to start implementing them (when it makes sense to do so).

In this section, you start by modeling a protocol and keep running into shortcomings, which you ultimately will solve with associated types. Along the way, you get to experience the reasoning and decision making of why you want to use PATs.