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.
Each time we create an instance:
We must use argument labels.
We can optionally use argument labels.
We don't need to use argument labels.
You're reading from Object???Oriented Programming with Swift 2
The rest of the page is locked
You have been reading a chapter from
Object???Oriented Programming with Swift 2Published in: Jan 2016Publisher: ISBN-13: 9781785885693
© 2016 Packt Publishing Limited All Rights Reserved