title: How to bind data from viewModel in view with rxSwift and Moya?
body: <p>I'm trying to create an app to get some news from an API and i'm using Moya, RxSwift and MVVM. 
  This is my ViewModel:</p>
  
  <pre><code>import Foundation
  import RxSwift
  import RxCocoa
  
  public enum NewsListError {
      case internetError(String)
      case serverMessage(String)
  }
  
  enum ViewModelState {
      case success
      case failure
  }
  
  protocol NewsListViewModelInput {
      func viewDidLoad()
      func didLoadNextPage()
  }
  
  protocol MoviesListViewModelOutput {
      var newsList: PublishSubject&lt;NewsList&gt; { get }
      var error: PublishSubject&lt;String&gt; { get }
      var loading: PublishSubject&lt;Bool&gt; { get }
      var isEmpty: PublishSubject&lt;Bool&gt; { get }
  }
  
  protocol NewsListViewModel: NewsListViewModelInput, MoviesListViewModelOutput {}
  
  class DefaultNewsListViewModel: NewsListViewModel{
  
      func viewDidLoad() {
  
      }
  
      func didLoadNextPage() {
  
      }
  
  
      private(set) var currentPage: Int = 0
      private var totalPageCount: Int = 1
  
      var hasMorePages: Bool {
          return currentPage &lt; totalPageCount
      }
      var nextPage: Int {
          guard hasMorePages else { return currentPage }
          return currentPage + 1
      }
  
      private var newsLoadTask: Cancellable? { willSet { newsLoadTask?.cancel() } }
  
      private let disposable = DisposeBag()
  
      // MARK: - OUTPUT
      let newsList: PublishSubject&lt;NewsList&gt; = PublishSubject()
      let error: PublishSubject&lt;String&gt; = PublishSubject()
      let loading: PublishSubject&lt;Bool&gt; = PublishSubject()
      let isEmpty: PublishSubject&lt;Bool&gt; = PublishSubject()
  
      func getNewsList() -&gt; Void{
          print("sono dentro il viewModel!")
          NewsDataService.shared.getNewsList()
              .subscribe { event in
                  switch event {
                  case .next(let progressResponse):
                      if progressResponse.response != nil {
                          do{
                              let json = try progressResponse.response?.map(NewsList.self)
                              print(json!)
                              self.newsList.onNext(json!)
                          }
                          catch _ {
                              print("error try")
                          }
                      } else {
                          print("Progress: \(progressResponse.progress)")
                      }
                  case .error( _): break
                  // handle the error
                  default:
                      break
                  }
          }
      }
  
  }
  </code></pre>
  
  <p>This is my ViewController, where xCode give me the following error when i try to bind to tableNews:</p>
  
  <pre><code>Expression type 'Reactive&lt;_&gt;' is ambiguous without more context
  </code></pre>
  
  <pre><code>import UIKit
  import RxSwift
  import RxCocoa
  
  class ViewController: UIViewController {
  
      @IBOutlet weak var tableNews: UITableView!
  
      let viewModel = DefaultNewsListViewModel()
  
      var disposeBag = DisposeBag()
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
      }
  
      private func setupBindings() {
  
          viewModel.newsList.bind(to: tableNews.rx.items(cellIdentifier: "Cell")) {
              (index, repository: NewsList, cell) in
              cell.textLabel?.text = repository.name
              cell.detailTextLabel?.text = repository.url
          }
          .disposed(by: disposeBag)
      }
  }
  </code></pre>
  
  <p>This is the service that get data from API:</p>
  
  <pre><code>
  import Moya
  import RxSwift
  struct NewsDataService {
      static let shared = NewsDataService()
  
      private let disposable = DisposeBag()
  
      private init() {}
  
      fileprivate let newsListProvider = MoyaProvider&lt;NewsService&gt;()
  
      func getNewsList() -&gt; Observable&lt;ProgressResponse&gt; {
          self.newsListProvider.rx.requestWithProgress(.readNewsList)
          }
      }
  
  </code></pre>
  
  <p>I'm new at rxSwift, I followed some documentation but i'd like to know if i'm approaching in the right way. Another point i'd like to know is how correctly bind my tableView to viewModel.
  Thanks for the support.</p>