Search code examples
reactive-cocoa

How to handle RAC binding with failed network signal in Reactive Cocoa


In the following code,

RAC(photoModel, thumbnailData) = [self download:photoModel.thumbnailURL];

I bound the thumbnail of a model to a network signal, if it fails it should be retried, but RAC cannot be rebound. Should use side effect instead of binding or rebind it manually?


Solution

  • Have a look at the -retry: operator. If you apply it to the signal returned from the -download method, then any error sent by the signal will cause the download signal to retry.