We want to know when the instances of the
Circle class will be removed from memory—that is, when the objects aren't referenced by any variable and the automatic reference count mechanism decides that they have to be removed from memory. Deinitializers are special parameterless class methods that are automatically executed just before the runtime destroys an instance of a given type. Thus, we can use them to add any code we want to run before the instance is destroyed. We cannot call a deinitializer; they are only available for the runtime.
The deinitializer is a special class method that uses the
deinit keyword in its declaration. The declaration must be parameterless, and it cannot return a value.
The following lines ...