What are protocol extensions?

This might sound obvious, but protocol extensions are extensions to protocols as opposed to concrete types. For example, the BinaryInteger protocol is adopted by all integer types: Int, Int64, UInt8, and so on. If you wanted to add a method to all of those at once, you’d use a protocol extension to modify BinaryInteger, like this: