Storage Modifiers (Cocoa)

On the Cocoa platform, which uses ARC rather than Garbage Collection for memory management, the three storage modifier keywords strong, weak and 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.

Read more about this topic in the Storage Modifiers topic in the Cocoa platform section.

var x: weak Button;

Cocoa Only

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.

See Also