1

我正在尝试让 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)
4

1 回答 1

0

从 Swift 2.1 迁移到 Swift 2.2 时,Reactive Cocoa 中的某些东西被破坏了。更新到最新的提交,现在它就像一个魅力。

于 2016-03-25T11:32:15.920 回答