How to declare an array of weak references in Swift?
Hi everyone! I'm new to Swift and trying to understand memory management. I have a class `Delegate` that is used as a delegate for multiple objects. I want to store a list of these delegates in an array, but I don't want the array to hold strong references to them, otherwise memory leaks or circular references will occur.\n\nIn Objective-C, I used `NSPointerArray` with the `NSPointerFunctionsWeakMemory` option. But in Swift, I can't simply write `weak var delegates: [Delegate]` — the compiler gives an error: `'weak' may only be applied to class and class-bound protocol types, not array`.\n\nHere is an example of my code:\n\n```swift\nclass Delegate {\n weak var owner: SomeClass?\n func didSomething() { }\n}\n\nclass SomeClass {\n // How to make this array weak?\n var delegates: [Delegate]