5

Is it possible to make extension of structure Reactive, where base class is my custom control inherited from UIControl?

When I'm trying following code:

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
            }
        )
    }
}

I'm getting following error:

Instance member "value" cannot be used on type 'Reactive<CustomControl>'

I will be grateful if you provide me any explanation.

Dmitriy Stupivtsev
  • 832
  • 1
  • 8
  • 17

1 Answers1

4

You can check this link: https://github.com/ReactiveX/RxSwift/issues/991

The method value isn't public so you need to create an public version of that. After that, it'll be possible create the extension for your custom control.