rx swift – The best way to make Customized Management Property with respect to get worth in iOS Mix?

[ad_1]

Right here is my code to arrange Customized Property in RXSwift for the UIControl however identical I’m not in a position to get in Mix though I’ve taken the CombineCocoa Reference.

public class OTPFieldView: UIControl, InputFieldView {
    public typealias FieldType = TOTPField
    public weak var area: TOTPField?

}

extension Reactive the place Base: InputFieldView, Base: UIControl, Base.FieldType.FieldValueType == String {
    public var textual content: ControlProperty<String?> {
        return base.rx.controlProperty(editingEvents: [.valueChanged], getter: { fieldView in
            return fieldView.area?.worth
        }, setter: { fieldView, worth in
            fieldView.updateValue(worth, isObfuscated: false, shouldSendActions: true, animated: true)
        })
    }
}

Public class Controller{

 var fieldView:OTPFieldView!

   fieldView.rx.textual content /// GETTING TRIGGER 

}

However identical factor when I’m attempting utilizing mix writer, getting following error beneath. UIContol doesn’t have textual content proerty.

Right here is my mix code.

public extension InputFieldView the place Self:UIControl,Self.FieldType.FieldValueType == String {
    var textPublisher: AnyPublisher<String?, By no means> {
        Publishers.ControlProperty(management: self, occasions: .defaultValueEvents, keyPath: .textual content)
                  .eraseToAnyPublisher()
 } // getting error .textual content Property

[ad_2]

Leave a Reply