Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions Source/RxSwift/ObservableType+ObjectMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,3 @@ public extension ObservableType where E == Response {
}
}
}


// MARK: - ImmutableMappable
public extension ObservableType where E == Response {

/// Maps data received from the signal into an object
/// which implements the ImmutableMappable protocol and returns the result back
/// If the conversion fails, the signal errors.
public func mapObject<T: ImmutableMappable>(_ type: T.Type, context: MapContext? = nil) -> Observable<T> {
return flatMap { response -> Observable<T> in
return Observable.just(try response.mapObject(T.self, context: context))
}
}

/// Maps data received from the signal into an array of objects
/// which implement the ImmutableMappable protocol and returns the result back
/// If the conversion fails, the signal errors.
public func mapArray<T: ImmutableMappable>(_ type: T.Type, context: MapContext? = nil) -> Observable<[T]> {
return flatMap { response -> Observable<[T]> in
return Observable.just(try response.mapArray(T.self, context: context))
}
}
}
23 changes: 0 additions & 23 deletions Source/RxSwift/Single+ObjectMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,3 @@ public extension PrimitiveSequence where TraitType == SingleTrait, ElementType =
}
}
}


// MARK: - ImmutableMappable
public extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Response {

/// Maps data received from the signal into an object
/// which implements the ImmutableMappable protocol and returns the result back
/// If the conversion fails, the signal errors.
public func mapObject<T: ImmutableMappable>(_ type: T.Type, context: MapContext? = nil) -> Single<T> {
return flatMap { response -> Single<T> in
return Single.just(try response.mapObject(type, context: context))
}
}

/// Maps data received from the signal into an array of objects
/// which implement the ImmutableMappable protocol and returns the result back
/// If the conversion fails, the signal errors.
public func mapArray<T: ImmutableMappable>(_ type: T.Type, context: MapContext? = nil) -> Single<[T]> {
return flatMap { response -> Single<[T]> in
return Single.just(try response.mapArray(type, context: context))
}
}
}