- Swift uses one of the following mechanisms to automatically deallocate the memory used by instances that aren't referenced anymore:
- Automatic Random Garbage Collector.
- Automatic Reference Counting.
- Automatic Instance Map Reduce.
- Swift executes an instance's deinitializer:
- Before the instance is deallocated from memory.
- After the instance is deallocated from memory.
- After the instance memory is allocated.
- A deinitializer:
- Can still access all of the instance's resources.
- Can only access the instance's methods but no properties.
- Cannot access any of the instance's resources.
- Swift allows us to define:
- Only one initializer per class.
- A main initializer and two optional secondary initializers.
- Many initializers with different arguments.
With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, interactive tutorials, and more.