Skip to content

mdb1/CoreNetworking

Repository files navigation

CoreNetworking

Swift

A lightweight networking library.

Usage

  • Use HTTPClient.shared for executing your requests.
  • You can change the default JsonDecoder if needed.

Logging

There is a NetworkLogger object, that, by default will print useful information about the requests and responses to the console.

If you don't want the logger, you can just override the object with a quiet configuration:

HTTPClient.shared.networkLogger = .init(configuration: .quiet)

// Or:
HTTPClient.shared.networkLogger = .init(
    configuration: .verbose(
        logRequests: true,  // Log requests
        logResponses: false // Doesn't log responses
    )
)

Success Example:

success

Decoding Issue Example:

error