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.
As you can see, they call it an abstract class, and yet there are questions like this dotted all over SO:
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?
source to share
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.
source to share