In Swift, memory management is handled through Automatic Reference Counting (ARC). ARC automatically tracks and manages the memory usage of instances of classes, structs, and enums.
For example, when an instance of a class is created, ARC allocates a chunk of memory to store information about that instance. As long as at least one active reference to that instance exists, ARC will continue to keep the instance alive in memory. When all references to an instance are removed, ARC will deallocate the memory used by that instance.