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.

26 lines
811 B

5 years ago
  1. //
  2. // mapTo+RxCocoa.swift
  3. // RxSwiftExt
  4. //
  5. // Created by Rafael Ferreira on 3/7/17.
  6. // Copyright © 2017 RxSwift Community. All rights reserved.
  7. //
  8. import RxCocoa
  9. extension SharedSequenceConvertibleType {
  10. /**
  11. Returns an Unit containing as many elements as its input but all of them are the constant provided as a parameter
  12. - parameter value: A constant that each element of the input sequence is being replaced with
  13. - returns: An unit containing the values `value` provided as a parameter
  14. */
  15. public func mapTo<R>(_ value: R) -> SharedSequence<SharingStrategy, R> {
  16. return map { _ in value }
  17. }
  18. @available(*, deprecated, renamed: "mapTo(_:)")
  19. public func map<R>(to value: R) -> SharedSequence<SharingStrategy, R> {
  20. return map { _ in value }
  21. }
  22. }