I am new in Swift. I have a base class:
class foo{}
I want to implement a foo collection class:
class foos: Array{}
In Swift 2.x you can use a protocol extension.
class Foo : Equatable {}
// you need to provide the Equatable functionality
func ==(leftFoo: Foo, rightFoo: Foo) -> Bool {
return ObjectIdentifier(leftFoo) == ObjectIdentifier(rightFoo)
}
extension Array where Element : Foo {}
protocol extensions provide "insert points" to extend classes that aren't classes, classes you don't own, etc.