Skip to content

Documentation Regarding Functions That Are Required by Protocol Should Be Marked "Required by Instance" #1246

@asaadjaber

Description

@asaadjaber

Motivation

I was reading the UICollectionViewDataSource documentation and when I clicked on the link to the collectionView(_:numberOfItemsInSection:) method, I saw "Instance Method" at the top which led me to be confused whether the UICollectionViewDataSource was a class or a protocol (it is a protocol).

The documentation does not distinguish between instance methods of classes vs protocols. For example, the documentation for the dequeueConfiguredReusableCell method identifies this method as an instance method as well.

Further, the documentation is clear:

Protocols can require specific instance methods and type methods to be implemented by conforming types.

The documentation also refers to methods that a protocol enforces as required as a "method requirement", or properties that a protocol enforces as required as "property requirements". The following example defines a protocol with a single instance method requirement: See "Here’s an example of a protocol with a single instance property requirement:", link.

Image

Proposed solution

The description above the the title of the required method name of a protocol should clearly say "Required by Instance", "Required Instance Method", or "Method Requirement". Similarly, for a required property name of a protocol, the documentation should read "Required by Instance", "Required Property Method" or "Property Requirement". This is in line with how method requirements and instance properties are referred to in the documentation, and more importantly, reduces the amount of confusion that is caused when one is reading documentation about required methods for classes vs required methods for protocols.

Alternatives considered

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions