我创建了一个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.
}
}