Storage Modifiers (Cocoa)
On the Cocoa platform, which uses ARC rather than Garbage Collection for memory management, the three storage modifier keywords
unretained are available to control how object references are stored in local variables, fields or properties.
By default, all variables and fields are
strong – that means when an object is
stored in the variable, its retain count is increased, and when a variable's value gets overwritten, the retain count of the previously stored object gets reduced by one.
var x: weak Button;
Storage Modifiers are relevant and available on the Cocoa platform, or when working with Cocoa objects on the Island/Darwin sub-platform. They can optionally be ignored on .NET, Java and Island, when Cross-Platform Compatibility Mode is enabled.