I am new in Swift. I have a base class:
class foo{}
I want to implement a foo collection class:
class foos: Array{}
Swift's Array
type is a structure, and in Swift, base classes must be actual classes (that is, class Foo
) and not structures.
So you cannot do what you are trying to do via inheritance from Array
, unfortunately. You could, however, store the array as a field within your class and forward methods to it, possibly implementing any protocols you want to support, et cetera.