i keep getting the same error that i can’t resolve, can anyone help me?
in this function:
func print<T: CustomStringConvertible>(label: String, event: Event) {
print(label, event.element ?? event.error ?? event)
}
i get this error:
error: RxSwiftPlayground.playground:49:32: error: value of optional type ‘Any?’ not unwrapped; did you mean to use ‘!’ or ‘?’?
print(label, event.element ?? event.error ?? event)
One of the ways I debug code when I’m going through a book is by comparing what I have with the books source code. Have you tried downloading the source code and running it separately? I’m asking this because if it’s a problem with the source code, then others will face the same issue, and we’ll have to look into making a correction. If not, then it is possible that perhaps the error could be something else.
Try that if you haven’t already and get back to us! If you have, then I apologize.
Hi @rcrdcst, I just confirmed that I do not get this warning in the book source code. There are 7 calls to that print(label:event:) function in the playground. You could try commenting them all out and uncommenting one at a time to see which call(s) cause the warning, and then compare that code with the book source code final playground. Let us know how that goes. Thanks!