Observable.just("800x600")
// .observeOn(ConcurrentDispatchQueueScheduler(qos: .default))
.map { $0.replacingOccurrences(of: "x", with: "/") }
.map { "https://picsum.photos/\($0)/?random" }
.map { URL(string: $0) }
.filter { $0 != nil }
.map { $0! }
.map { try Data(contentsOf: $0 }
.subscribeOn(ConcurrentDispatchQueueScheduler(qos: .default))
.map { UIImage(data: $0) }
.observeOn(MainScheduler.instance)
.subscribe(onNext: { image in
self.imageView.image = image
}).disposed(by: disposeBag)
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
00