Created
February 12, 2019 15:38
-
-
Save astrokin/131b5f30f68ee7e4ced447d16c6ab9c2 to your computer and use it in GitHub Desktop.
Optional+Logging
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 Optional { | |
func expectedToBe(_ logMessage: String? = nil, line: Int = #line, file: StaticString = #file) -> Wrapped? { | |
switch self { | |
case let .some(some): return some | |
case .none: | |
print("[OPTIONAL] \(#function) \(file):\(line) message \(String(describing: logMessage))") | |
return .none | |
} | |
} | |
} |
Author
astrokin
commented
Feb 12, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment