相关疑难解决方法(0)

委托方法必须声明为public

假设我有一堂课

public class MyClass: NSObject, ABCDelegate {
    func delegateMethod(a: a, b: b) {
        ...
    }
}
Run Code Online (Sandbox Code Playgroud)

这个委托方法由一个MyClass处理一些网络操作的单例调用.

事情是编译器抱怨Method 'delegateMethod(...)' must be declared public because it matches a requirement in public protocol 'ABCDelegate'.

我的问题是:

  1. 为什么编译器正在抱怨声明为private func或简单的方法func
  2. 如何声明ABCDelegate方法对此类是私有的?

ios swift

7
推荐指数
1
解决办法
2239
查看次数

标签 统计

ios ×1

swift ×1