Group Group Group Group Group Group Group Group Group

XCode can't recognize subscribe(onNext:) method CH 2, 3 & 4


#1

XCode cannot recognize the overloaded subscribe method with only onNext. I checked the method in the implementation (in RxSwift), and I think it should work. here is the method signature (from the RxSwift Library)

public func subscribe(onNext: ((Self.E) -> Swift.Void)? = default, onError: ((Error) -> Swift.Void)? = default, onCompleted: (() -> Swift.Void)? = default, onDisposed: (() -> Swift.Void)? = default) -> Disposable

what I’m expecting to happen
to do the following with no compilation error (this is from ch 4 project but this is my implementation & not the book implementation)

photosViewController.selectedImage.subscribe(onNext: { self.images.append($0) })

what actually happened
the following compilation error

Extraneous argument label ‘onNext:’ in call

with a suggested fix to make the subscribe method like the following

photosViewController.selectedImage.subscribe( { event in
self.images.append($0) })

whats the type of selectedImage?
Observable< UIImage >

Things I have tried
I deleted the derived data for the project, but it didn’t succeed

I had the same problem in different parts of the book & my solution was to submit to the compiler, BUT NOT TODAY!


#2

@scotteg Can you please help with this when you get a chance? Thank you - much appreciated! :]


#4