简体   繁体   中英

RxSwift: Error 'Type 'inout UITapGestureRecognizer' does not conform to protocol 'ReactiveCompatible'

I am trying to send an observable object of 'acceptGesture' into a viewmodel contractor.. However, xCode keep throwing error 'Type 'inout UITapGestureRecognizer' does not conform to protocol 'ReactiveCompatible''

Here is the example where I am following https://github.com/ReactiveX/RxSwift/tree/master/RxExample/RxExample/Examples/APIWrappers

import UIKit
#if !RX_NO_MODULE
import RxSwift
import RxCocoa
#endif

class JobsViewController: UIViewController {

    @IBOutlet weak var acceptClickableView: UIView!
    @IBOutlet weak var acceptGesture: UITapGestureRecognizer!

    private var viewModel: JobsViewModel!
    private let disposeBag = DisposeBag()

    override func viewDidLoad() {
        super.viewDidLoad()
        initView()

        viewModel = JobsViewModel()
        let input = JobsViewModel.Input(acceptTrigger: self.acceptGesture.rx.event.asObservable())
    }
}

import Foundation
#if !RX_NO_MODULE
import RxSwift
import RxCocoa
#endif

class JobsViewModel: ViewModelType {
    struct Input {
        let acceptTrigger:  Observable<UITapGestureRecognizer>

    }

    struct Output {}

    init(){}

    func transform(input: Input) -> Output {
        return Output()
    }
}

The problem is probably about the compile itself (xCode) .... I removed the parameter sent to ViewModel... and recompile again. Now it is working...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM