forked from cx-org/CombineX
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cx-org#106 from cx-org/fix-zip
Publishers.Zip should wait unapplied values before finish
- Loading branch information
Showing
4 changed files
with
97 additions
and
23 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
Sources/CombineX/Internal/Extensions/Completion+extensions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
extension Subscribers.Completion { | ||
|
||
func mapError<NewFailure: Error>(_ transform: (Failure) -> NewFailure) -> Subscribers.Completion<NewFailure> { | ||
switch self { | ||
case .finished: | ||
return .finished | ||
case .failure(let error): | ||
return .failure(transform(error)) | ||
} | ||
} | ||
|
||
var isFinished: Bool { | ||
switch self { | ||
case .finished: | ||
return true | ||
case .failure: | ||
return false | ||
} | ||
} | ||
|
||
var isFailure: Bool { | ||
switch self { | ||
case .finished: | ||
return false | ||
case .failure: | ||
return true | ||
} | ||
} | ||
|
||
var error: Failure? { | ||
switch self { | ||
case .finished: | ||
return nil | ||
case .failure(let error): | ||
return error | ||
} | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
Sources/CombineX/Internal/Extensions/Completion+mapError.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters