I need to store delegates which are views in a dictionary. Now I want to hold them as weak references, So if the user quits the screen my dictionary won't be the one preventing those views to cleanup.
I was trying to use the solution from:
How do I declare an array of weak references in Swift?
But for some reason as soon as I add the line of code where I try to get the real delegate from the weak object:
if let realDelegate = delegate.value {
realDelegate.updateProgressBar(Int(progress * 100), aTaskIndentifier: downloadTask.taskIdentifier)
}
I get the following error in Xcode at compile time:
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
Do you know what is the problem with this solution? Or maybe you could provide another solutions for this task?