I am new to RxSwift programming. I am confused between the two while coding. Which one should be used to store datasource of table and how to decide that ?
Another important point that was alluded to by @RobMayoff in his comment. Neither a PublishSubject nor a PublishRelay stores state, so neither of them are a good idea to "store datasource of table".
Fortunately, you don't need to store the state yourself because the DataSource object that the items
operator creates internally stores it.
In other words, you don't need to use a Subject or Relay (of any sort) to feed a table view. Just use an Observable.