When I'm declaring variables as weak
in Swift, I sometimes get the error message from Xcode:
'weak' may only be applied to class and class-bound protocol types
or
'weak' must not be applied to non-class-bound 'SomeProtocol'; consider adding a protocol conformance that has a class bound
I'm wondering why the keyword weak
can only applied to class and class-bound protocol types? What is the reason behind this requirement?