If there are no abstract classes, why do they refer to them in the documentation?

I looked at Apple's documentation on UICollectionViewLayout

and saw this:

An abstract base class for generating layout information for a collection view.

Source

As you can see, they call it an abstract class, and yet there are questions like this dotted all over SO:

Abstract class in Swift

Abstract classes in Swift

All of these answers say that there is no concept of "abstract class" in Objective-C or Swift.

If so, why are they constantly referring to it?

+3


source to share


1 answer


However, there are no abstract classes in Swift, the closest representation will be protocols.



But in this particular case, an abstract class means that you don't have to use the class UICollectionViewLayout

yourself - either a subclass to provide custom layout and behavior, or use UICollectionViewFlowLayout

(which inherits from UICollectionViewLayout

) if you need a default layout.

+1


source







All Articles