EZNetworking

5.5.0

A lightweight Swift networking library for handling API requests.
Aldo10012/EZNetworking

What's New

5.5.0

2026-03-01T08:20:18Z

What's new?

Updated FileDownloadable and FIleDownloader

New File Download Explained

FileDownloader is an actor-based downloader that supports pause, resume, and cancel. It exposes a single AsyncStream<DownloadEvent> API.

Basic Usage

let url = URL(string: "https://example.com/file.pdf")!
let downloader = FileDownloader(url: url)

for await event in await downloader.downloadFileStream() {
    switch event {
    case .started:
        // download started
    case .progress(let progress):
        // handle progress (0.0 to 1.0)
    case .completed(let localURL):
        // handle downloaded file at localURL
    case .failed(let error):
        // handle error
    case .failedButCanResume(let error):
        // download failed but can be resumed by calling resume()
    case .paused:
        // download paused
    case .resumed:
        // download resumed
    case .cancelled:
        // download cancelled
    }
}

Pause, Resume, and Cancel

let downloader = FileDownloader(url: URL(string: "https://example.com/file.pdf")!)

// Start consuming events in a background task
let eventsTask = Task {
    for await event in await downloader.downloadFileStream() {
        // handle events
    }
}

// Pause the download
try await downloader.pause()

// Resume the download
try await downloader.resume()

// Cancel the download
try downloader.cancel()

EZNetworking

Swift Platform SPM Compatible

EZNetworking is a powerful, lightweight Swift networking library that simplifies API interactions in your iOS applications. Built with modern Swift features, it provides an intuitive interface for making HTTP requests, handling responses, and managing network operations.

Key Features 🚀

  • Modern Swift Support: Built with Swift 5.9 and iOS 15.0+, macOS 12+, watchOS 8+, tvOS 15+, visionOS 1+
  • Async/Await Integration: First-class support for Swift concurrency
  • Combine Support: Publishers for requests, downloads, uploads, WebSocket, and SSE
  • Callback Support: Completion handler-based API across the board
  • AsyncStream Support: Streaming progress for uploads, downloads, and real-time events
  • Type-Safe Networking: Strong typing for requests and responses
  • Flexible Request Building: Multiple approaches to creating requests
  • Comprehensive Interceptors: Full request/response pipeline control
  • Built-in Caching: Efficient response caching system
  • File Download: Easy-to-use file downloader
  • File Upload: Easy-to-use file uploader
  • Data Upload: Easy-to-use data uploader
  • Multipart Form Data: Construct multipart requests with boundary handling and MIME types
  • WebSocket: Real-time, bi-directional client-to-server communication
  • Server-Sent Events: Lightweight, server-to-client streaming with automatic reconnection
  • Extensive Testing: 100% unit test coverage

Table of Contents 📑

Installation 📦

Swift Package Manager

Add EZNetworking to your project using Swift Package Manager:

dependencies: [
    .package(url: "https://github.com/Aldo10012/EZNetworking.git", from: "5.2.0")
]

Or through Xcode:

  1. Go to File > Add Packages
  2. Enter: https://github.com/Aldo10012/EZNetworking.git
  3. Select version: 5.2.0 or later

Quick Start Guide 🚀

Here's a simple example to get you started:

// Create a request
let request = RequestFactoryImpl().build(
    httpMethod: .GET,
    urlString: "https://api.example.com/data",
    parameters: [.init(key: "userId", value: "123")]
)

// Using async/await
do {
    let response = try await RequestPerformer().perform(
        request: request,
        decodeTo: UserData.self
    )
    print("User data: \(response)")
} catch {
    print("Error: \(error)")
}

Scripts

swiftformat Sources Tests

  • Automatically formats the Swift code according to the rules defined in .swiftformat configuration file.

swiftlint Sources Tests

  • Analyzes the Swift code and reports violations of the rules defined in .swiftlint.yaml configuration file.

swiftlint --fix Sources Tests

  • Automatically fixes auto-correctable SwiftLint violations in the code.

Contributing 🤝

Contributions to are always welcomed! For more details see CONTRIBUTING.md.

License 📄

EZNetworking is available under the MIT license. See the LICENSE file for more info.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Tue Mar 03 2026 10:55:34 GMT-1000 (Hawaii-Aleutian Standard Time)