Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialdurul
62,690 PointsCannot convert return expression of type SignalProducer<UIImage, AnyError>
Hello,
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'
end
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
Soner Güler
16,505 PointsYou just need to change NSError to AnyError. If it does not work, try to get latest version of ReactiveCocoa and ReactiveSwift