Skip to content

Instantly share code, notes, and snippets.

@zafarivaev
Last active January 19, 2022 16:04
Show Gist options
  • Save zafarivaev/7c667d9ffe140cf19f8dd00be208a9d5 to your computer and use it in GitHub Desktop.
Save zafarivaev/7c667d9ffe140cf19f8dd00be208a9d5 to your computer and use it in GitHub Desktop.
import UIKit
import Combine
...
class ViewController: UIViewController {
...
override func viewDidLoad() {
super.viewDidLoad()
overrideUserInterfaceStyle = .light
getAvatarFromTheServer()
.handleEvents(...)
//
.delay(for: 1, scheduler: DispatchQueue.global())
//
.retry(3)
.receive(on: DispatchQueue.main)
.sink(...)
.store(in: &cancellables)
}
private func getAvatarFromTheServer() -> AnyPublisher<UIImage, Error> {
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment