Skip to content

Instantly share code, notes, and snippets.

@yzhong52
Last active February 17, 2020 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yzhong52/acbb6903d9c412620b46cfa3b471363c to your computer and use it in GitHub Desktop.
Save yzhong52/acbb6903d9c412620b46cfa3b471363c to your computer and use it in GitHub Desktop.
Building a Client App From Scratch (ViewController with Client)
import UIKit
import RxSwift
class ViewController: UIViewController {
private let disposeBag = DisposeBag()
private let client = NewsClient()
override func viewDidLoad() {
super.viewDidLoad()
client.headlines().subscribe(onSuccess: { (response) in
print("Receive news: \(response)")
}, onError: { (error) in
print("Receive error: \(error)")
}).disposed(by: disposeBag)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment