4. Protocols and Categories
Item 23: Use Delegate and Data Source Protocols for Interobject Communication
- A delegate property will always be defined using the weak attribute.
- If required, implement the bitfield structure approach to cache which methods a delegate responds to from the protocol.
Item 24: Use Categories to Break Class Implementation into Manageable Segments
- Use categories to split a class implementation into more manageable fragments.
- Create a category called Private to hide implementation detail of methods that should be considered as private.
Item 25: Always Prefix Category Names on Third-Party Classes
Item 26: Avoid Properties in Categories
- Can use associated objects instead, but not good enough.
Item 27: Use the Class-Continuation Category to Hide Implementation Detail
Item 28: Use a Protocol to Provide Anonymous Objects
沒有留言:
張貼留言