Output is a simple print statement wrapper to make your application's logging more descriptive and easier to understand.
Output uses Swift's strong type system to make it obvious what your print statements are meant to be displaying both in your code and in your program's output:
log(.success("Successfully downloaded image!"))
=>
✅ Successfully downloaded image!
Output also provides helpers to make logging work the way it should do. We often deal with Result
types when we're dealing with asynchronous actions such as web requests. Passing a Result
type to Output's log
function will bridge the outcome to either .success
or .failure
resulting in a more descriptive output:
let result: Result<Any, LocalizedNetworkError> = .failure(NetworkError.forbidden)
log(result)
=>
❌ Error 403: Forbidden - Your LocalizedNetworkError description