Swift "retry" logic on request : <p>So i'm a bit lost on how to implement a retry logic when my upload request fail.</p>

<p>Here is my code i would like some guidance on how to do it</p>

<pre><code>func startUploading(failure failure: (NSError) -&gt; Void, success: () -&gt; Void, progress: (Double) -&gt; Void) {
        DDLogDebug("JogUploader: Creating jog: \(self.jog)")

        API.sharedInstance.createJog(self.jog,
            failure: { error in
                failure(error)
            }, success: {_ in
                success()
        })
    }
</code></pre>
