2
是否可以擴展結構Reactive,其中基類是從UIControl繼承的我的自定義控件?爲自定義UIControl創建ControlProperty
當我嘗試下面的代碼:
extension Reactive where Base: CustomControl {
public var value: ControlProperty<CGFloat> {
return CustomControl.rx.value(
self.base,
getter: { customControl in
customControl.customProperty
},
setter: { customControl, value in
customControl.customProperty = value
}
)
}
}
我收到以下錯誤:
Instance member "value" cannot be used on type 'Reactive<CustomControl>'
我會很感激,如果你給我提供任何解釋。
它的工作原理,非常感謝你! –