samedi 26 décembre 2015

Swift: conforming to protocol using extension and composition pattern

On slide 62 in this PDF: Some Columbia College Presentation it says that one of the ideas behind Swift and its extensions was to conform to protocols using the composition pattern.

Now I understand the syntax for extensions in Swift

//example from Apple:
extension SomeType: SomeProtocol, AnotherProtocol {
// implementations of not yet provided functions and properties of SomeType go here
}

But what does the composition pattern have to do with it? The guy did mean the composite pattern described here, right? Can someone please provide a minimal example how it is used?

Aucun commentaire:

Enregistrer un commentaire