【发布时间】:2015-11-19 23:57:07
【问题描述】:
我正在尝试制作一个 UITextField 扩展,它在设置委托时执行附加功能。
extension UITextField {
override weak public var delegate: UITextFieldDelegate? {
didSet {
print("Do stuff")
}
}
}
这会失败并出现三个错误:
'delegate' used within its own type
'weak' cannot be applied to non-class type '<<error type>>'
Property does not override any property from its superclass
我需要更改哪些Do stuff 才能在委托设置时打印?
【问题讨论】:
标签: ios swift delegates uitextfield