4 ms·
This sort of thing is a common pattern in Go, where it is accomplished by the fact that Go interfaces do not require types to opt into them by declaring their a
by bww 5y ago
This sort of thing is a common pattern in Go, where it is accomplished by the fact that Go interfaces do not require types to opt into them by declaring their adoption. If a type conforms to the interface it's a type of the interface.
So one can create a new interface type that supports the specific subset of functionality you need from a larger type that you don't control and use it in a similar way to Swift protocols.
- monocularvision 5y agoWhile you have to declare it, you can do the same in Swift using an extension.