It will take about 2 minutes to finish reading this article.
1. Use structures when you’re modeling data.
Use structures when you’re modeling data that contains information about an entity with an identity that you don’t control. For example:
1 | struct PenPalRecord { |
2. Use Structures and Protocols to Model Inheritance and Share Behavior.
Structures and classes both support a form of inheritance. Structures and protocols can only adopt protocols; they can’t inherit from classes. However, the kinds of inheritance hierarchies you can build with class inheritance can be also modeled using protocol inheritance and structures.
1 | protocol AnimalCommonProtocol { |