swift protocol 'weak' cannot be applied to non-class type

前端 未结 5 2324
误落风尘
误落风尘 2020-12-05 04:00

I\'m a bit confused. What\'s the difference between protocol A : class { ... } and protocol A{ ... }, and which one we should use in swift?

<
5条回答
  •  我在风中等你
    2020-12-05 04:36

    You can make the protocol derive from any class type like NSObject, or AnyObject. e.g :

    protocol TopNewsTableDelegate  : AnyObject{
      func topNewsTableDidLoadedStories()
    }
    

提交回复
热议问题