Skip to content

Property Patterns #7

@markavitale

Description

@markavitale

Convention

  • Properties should maintain state
  • No mutable collections in properties
  • Property accessor methods should have minimal, predictable side effects
  • When overriding the getter, we almost certainly want to override the setter
  • If overriding the setter, you need to override the getter unless the setter override calls super

Rationale

Different rationales per convention, but generally these are good patterns to follow to make your code more maintainable and match the way Apple use properties.

Example

TBD

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions