Why can the keyword “weak” only be applied to class and class-bound protocol types

后端 未结 11 1346
清酒与你
清酒与你 2020-12-13 03:14

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

11条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-13 04:11

    I was using objective C class in swift for a scrolView. I created IBOutlet of that scroll view. And while compiling code this error started showing.

    So to fix this kind of issue, import that class in your bridging header

    import "YourClass.h"

    I was using Xcode 9.2 with swift 3.2

提交回复
热议问题