Search code examples
iosswiftreactive-cocoareactive-cocoa-4

CocoaAction not triggering Action


I'm trying to get the CocoaAction to invoke the Action. The CocoaAction is triggered but the Action is never executed. Can anyone see where I'm going wrong with this?

    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)

Solution

  • Turns out it something in Reactive Cocoa broken when moving from Swift 2.1 to Swift 2.2. Updated to the latest commit and now it works like a charm.