Git Product home page Git Product logo

Comments (6)

andersio avatar andersio commented on May 1, 2024 1

https://github.com/ReactiveCocoa/ReactiveObjCBridge/blob/master/ReactiveObjCBridge/ObjectiveCBridging.swift#L122

It seems it was replaced by bridgedSignalProducer(from:) due to limitations of ObjC generics in Swift.

from reactiveobjcbridge.

andersio avatar andersio commented on May 1, 2024

You can produce a Signal from a SignalProducer using startWithSignal. Note that the subscription side effect would run after the setUp closure is invoked, but before startWithSignal returns.

signal.toSignalProducer().startWithSignal { signal, interrupter in
    // Do your stuff with `signal`.
}

from reactiveobjcbridge.

opfeffer avatar opfeffer commented on May 1, 2024

Thanks for getting back to me.

I'm afraid I didn't do a very good job describing my problem - I have an ObjC interface that looks like so:

 @property (nonatomic, strong, readonly) RACSignal<NSDictionary *> *events;

Now, my view/business layer is written in swift mostly and I'm trying to combine events with some other Swift-defined Signals. I was able to achieve the reverse, Swift->ObjC with ReactiveObjCBridge's extensions to SignalProtocol

 public func toRACSignal() -> RACSignal<Self.Value.Wrapped>

but I'm not sure how I can transform a RACSignal to a Signal?

In your response, you said signal.toSignalProducer().startWithSignal { ... }, but events.toSignalProducer() throws compiler warning:

Compiler

What am I missing? Thanks!

from reactiveobjcbridge.

NikKovIos avatar NikKovIos commented on May 1, 2024

@andersio @opfeffer
Could you please explain how to properly convert RACSignal to SignalProducer?
I've write something like

extension RACSignal {
    func toSignalProducer() -> SignalProducer<ValueType, AnyError> {
        return SignalProducer(self)
    }
}

but the compiler warn at it(

from reactiveobjcbridge.

andersio avatar andersio commented on May 1, 2024

@NikKovIos

It should be ValueType? since ValueType is annotated as nullable for API backwards compatibility.

But AFAIK it still won’t compile β€” there are plenty of restrictions in Swift regarding Objective-C lightweight generics, and they are part of the rationale behind the current interop API besides Swiftification. At least last when we tried, the compiler rejects any extension referring to any generic parameter.

from reactiveobjcbridge.

NikKovIos avatar NikKovIos commented on May 1, 2024

Yes, so i manually wrap every rac_.. to SignalProducer (

from reactiveobjcbridge.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.