由于内部'内部代表无法访问保护水平

时间:2017-01-19 07:18:18

标签: ios swift swift3 swift-protocols

我创建了一个pod库in here

库包含协议。当我从cocoapods安装库并尝试符合协议时出现delegate is inaccessible due to 'internal' protection level错误。

协议:

@objc public protocol TDDropdownListDelegate { func listTapped(sender: UIButton) }

协议功能:

open func listTapped(sender: UIButton) {
    activate(sender: sender)
    delegate?.listTapped(sender: sender)
}

我收到错误的代码

import UIKit
import TDDropdownList

class ViewController: UIViewController,TDDropdownListDelegate {
let a = TDDropdownList(frame: CGRect(x: 100 , y: 100 , width: 200 , height: 75))
override func viewDidLoad() {
    a.initialize(data: ["Emre","Duman"])

    a.delegate = self  // LINE I GOT THE ERROR

    self.view.addSubview(a)
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}
func listTapped(sender: UIButton) {
    print(sender.currentTitle!)
}
override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}


}

0 个答案:

没有答案