David Pilkington
David Pilkington

Reputation: 13628

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

I was looking through the Apple documentation on the UICollectionViewLayout and saw this:

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

Source

As you can see, they refer to this as an abstract class, and yet, there are questions like this littered all over SO:

Abstract class in Swift

Abstract classes in Swift Language

In all of these, the answers say that there is no concept of "abstract class" in Objective-C or Swift.

If this is true, why do they continuously refer to it?

Upvotes: 3

Views: 142

Answers (1)

mag_zbc
mag_zbc

Reputation: 6992

True, there are no abstract classes in Swift, the closest representation would be protocols.

But in this particular case abstract class means that you're not supposed to use UICollectionViewLayout class yourself - either subclass it to provide a custom layout and behaviour, or use UICollectionViewFlowLayout (which inherits from UICollectionViewLayout) if you want the default layout.

Upvotes: 1

Related Questions