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.
 
 
 
 

22 lines
657 B

//
// mapAt.swift
// RxSwiftExt
//
// Created by Michael Avila on 2/8/18.
// Copyright © 2018 RxSwift Community. All rights reserved.
//
import RxSwift
extension ObservableType {
/**
Returns an observable sequence containing as many elements as its input but all of them are mapped to the result at the given keyPath
- parameter keyPath: A key path whose root type matches the element type of the input sequence
- returns: An observable squence containing the values pointed to by the key path
*/
public func mapAt<R>(_ keyPath: KeyPath<E, R>) -> Observable<R> {
return self.map { $0[keyPath: keyPath] }
}
}