objc-guide icon indicating copy to clipboard operation
objc-guide copied to clipboard

Property Patterns

Open markavitale opened this issue 5 years ago • 0 comments

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

markavitale avatar Jun 05 '20 05:06 markavitale