Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Signal vs SignalProducer

durul dalkanat
durul dalkanat
62,690 Points

Cannot convert return expression of type SignalProducer<UIImage, AnyError>


I have taken error message from return expression below blocks

func imageProducer(for photo: Photo) -> SignalProducer<UIImage,NSError>    {
    let request = URLRequest(url: URL(string: photo.imageURL)!)
    let signal = URLSession.shared.reactive
        .data(with: request)
        .observe(on: ImmediateScheduler())
        .map { (data, response) -> UIImage in
            return UIImage(data: data)!
    return signal

my pod details.

target 'MarsRover' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks use_frameworks!

# Pods for FRP-Login
pod 'ReactiveSwift', :git => 'https://github.com/ReactiveCocoa/ReactiveSwift.git', :tag => '1.0.0'
pod 'ReactiveCocoa', :git => 'https://github.com/ReactiveCocoa/ReactiveCocoa.git', :tag => '5.0.0'
pod 'Result', :git => 'https://github.com/antitypical/Result.git', :tag => '3.1.0'


post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '3.0' end end end

1 Answer

You just need to change NSError to AnyError. If it does not work, try to get latest version of ReactiveCocoa and ReactiveSwift