Skip to content

NS

Pre-release
Pre-release
Compare
Choose a tag to compare
@kzaher kzaher released this 01 Sep 11:33
· 3293 commits to main since this release

This is a alpha version of RxSwift 2.0.

New version of the language helped us to improve a lot of things and this is a short summary of changes.

  • Removes deprecated APIs
  • Adds ObservableType
  • Moved from using >- operator to protocol extensions .
  • Adds support for Swift 2.0 error handling try/do/catch

You can now just write

    API.fetchData(URL)
      .map { rawData in
          if invalidData(rawData) {
              throw myParsingError
          }

          ...

          return parsedData
      }
  • RxCocoa introduces bindTo extensions
    combineLatest(firstName.rx_text, lastName.rx_text) { $0 + " " + $1 }
            .map { "Greeting \($0)" }
            .bindTo(greetingLabel.rx_text)

... works for UITableView/UICollectionView too

viewModel.rows
            .bindTo(resultsTableView.rx_itemsWithCellIdentifier("WikipediaSearchCell")) { (_, viewModel, cell: WikipediaSearchCell) in
                cell.viewModel = viewModel
            }
            .addDisposableTo(disposeBag)
  • Adds new operators (array version of zip, array version of combineLatest, ...)
  • Renames catch to catchError
  • Change from disposeBag.addDisposable to disposable.addDisposableTo
  • Deprecates aggregate in favor of reduce
  • Deprecates variable in favor of shareReplay(1) (to be consistent with RxJS version)

Check out Migration guide to RxSwift 2.0