I'm trying to return an RACSignal
that I can use in my objective-c code, I've tried various ways. EX:
@objc
class func getPosts() -> RACSignal {
let (signal, observer) = Signal<String, NSError>.pipe()
return signal.toRACSignal()
}
Also this way.
@objc
class func getPosts() -> RACSignal {
return SignalProducer {
observer, disposable in
}.toRACSignal()
}
But XCode
always says the same:
ambiguous reference to member toRACSignal
My podfile looks like this:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'Bebler' do
pod 'ComponentKit', '= 0.14'
pod 'ReactiveCocoa', '~> 4.1.0'
pod 'AFNetworking', '~> 3.1'
pod 'Alamofire', '~> 3.3'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'KeychainSwift', '~> 3.0'
end
I have Xcode version 7.3
also tried this:
@objc
class func getPosts() -> RACSignal {
let signalProducer: SignalProducer<String, NSError> = SignalProducer {
observer, disposable in
}
return signalProducer.toRACSignal()
}
same result.
you may try it like this: (optionals)
@objc
class func getPosts() -> RACSignal? {
if let (signal, observer) = Signal<String, NSError>.pipe() as? Signal! {
return signal.toRACSignal()
}
return nil
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.