-
Notifications
You must be signed in to change notification settings - Fork 1
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 #26 from vespinola/6-log-api-requests
added logger in api request client
- Loading branch information
Showing
4 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
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
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
20 changes: 20 additions & 0 deletions
20
mobile-courier-app/Data/Networking/Extensions/Data+Data.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,20 @@ | ||
// | ||
// Data+Data.swift | ||
// mobile-courier-app | ||
// | ||
// Created by Vladimir Espinola on 2024-06-25. | ||
// | ||
|
||
import Foundation | ||
|
||
extension Data { | ||
var prettyPrintedJSONString: String? { | ||
do { | ||
let jsonObject = try JSONSerialization.jsonObject(with: self, options: []) | ||
let prettyData = try JSONSerialization.data(withJSONObject: jsonObject, options: [.prettyPrinted]) | ||
return String(data: prettyData, encoding: .utf8) | ||
} catch { | ||
return nil | ||
} | ||
} | ||
} |