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>'
我会很感激,如果你给我提供任何解释。
它的工作原理,非常感谢你! –