RxSwift:错误'类型'inout UITapGestureRecognizer'不符合协议'ReactiveCompatible'

时间:2017-08-29 05:26:30

标签: ios swift reactive-programming

我试图将一个'acceptGesture'的可观察对象发送到一个viewmodel承包商。但是,xCode不断抛出错误'Type'inout UITapGestureRecognizer'不符合协议'ReactiveCompatible''

以下是我关注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()
    }
}

1 个答案:

答案 0 :(得分:0)

问题可能在于编译本身(xCode)....我删除了发送到ViewModel的参数...并重新编译。现在它正在运作......