You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
616 B

5 years ago
  1. //
  2. // mapTo.swift
  3. // RxSwiftExt
  4. //
  5. // Created by Marin Todorov on 4/12/16.
  6. // Copyright © 2016 RxSwift Community. All rights reserved.
  7. //
  8. import Foundation
  9. import RxSwift
  10. extension ObservableType {
  11. /**
  12. Returns an observable sequence containing as many elements as its input but all of them are the constant provided as a parameter
  13. - parameter value: A constant that each element of the input sequence is being replaced with
  14. - returns: An observable sequence containing the values `value` provided as a parameter
  15. */
  16. public func mapTo<R>(_ value: R) -> Observable<R> {
  17. return map { _ in value }
  18. }
  19. }