CocoaAction不会触发Action

时间:2016-03-24 12:15:38

标签: ios swift reactive-cocoa reactive-cocoa-4

我试图让CocoaAction调用Action。触发CocoaAction但从未执行Action。任何人都可以看到我在哪里出错吗?

    let a = Action<Bool, Void, NoError> { val in
        return SignalProducer { sink, _ in
            print("I has a value: \(val)")
            sink.sendCompleted()
        }
    }

    self.cocoaAction = CocoaAction(a) { _ in
        return true
    }

    self.myButton.addTarget(self.cocoaAction, action: CocoaAction.selector, forControlEvents: .TouchUpInside)

1 个答案:

答案 0 :(得分:0)

当从Swift 2.1移动到Swift 2.2时,Reactive Cocoa中出现了一些问题。更新到最新提交,现在它就像一个魅力。