Last active
May 2, 2020 02:35
-
-
Save eMdOS/d869c0bb15f7e3f684e79e086b0699b5 to your computer and use it in GitHub Desktop.
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
public extension Result where Success == (data: Data, response: URLResponse) { | |
func map<T>(_ keyPath: KeyPath<Success, T>) -> Result<T, Failure> { | |
switch self { | |
case .success(let response): | |
return .success(response[keyPath: keyPath]) | |
case .failure(let error): | |
return .failure(error) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment