Skip to content

Conversation

@plajdo
Copy link
Contributor

@plajdo plajdo commented Jul 2, 2025

## Migration guide:

  • Removeimport Alamofire and @preconcurrency import Alamofire
  • Replace BaseUrlProvider with URLConvertible
  • Replace func resolveBaseUrl() async -> String? -> func resolveUrl() async -> URL? (in URL providers)
  • Replace func url(on baseUrl: String) throws -> URL in Endpoints with func url(on baseUrl: any URLConvertible) async -> URL? or remove the function completely where default implementation is sufficient. Replace throw-s with return nil.
  • Replace var path: String { with var path: URLConvertible { and import GoodNetworking where required. Take care not to replace unrelated implementations.
  • Wrap string return values in URL(string:)
  • Replace Alamofire implementation of AuthenticatorInterceptors with new, simpler Authenticator protocol
  • Adapters, Retriers and Interceptors are now from local package (API is similar, but will require manual migration)
  • Simplified error handling to only 3 cases in NetworkError: local (network failure), remote (Invalid HTTP status code, server errors) and decoding (decoding failures).
  • GoodLogger dependency removed and replaced with local logging protocol

Copy link
Contributor

@marekVrican marekVrican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

postrehy:

  • zbytocne subory a vyblokovany kod som nekomentoval ked pises ze strukturu budes este upravovat.
  • pri buildovani sample projektu mi vyhodilo este zopar chyb, skus pozriet pls

@plajdo plajdo changed the title Swift 6.2 Swift 6.2 & GoodNetworking 4.0 Aug 8, 2025
@plajdo plajdo marked this pull request as ready for review August 8, 2025 09:47
@plajdo plajdo requested review from andrej-jasso, marekVrican and matusklasovity and removed request for marekVrican August 8, 2025 09:48
@matusklasovity matusklasovity requested a review from Copilot August 11, 2025 09:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates GoodNetworking from version 3.x to 4.0, updating from Swift 5.x to Swift 6.2 compatibility and removing the Alamofire dependency in favor of a custom networking implementation.

  • Complete rewrite of the core networking layer using native URLSession instead of Alamofire
  • Introduction of a new global NetworkActor for thread-safe network operations
  • Simplified error handling model with only 3 error types: local, remote, and decoding

Reviewed Changes

Copilot reviewed 82 out of 87 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Tests/GoodNetworkingTests/Tests/*.swift All test files removed - likely being replaced with new test suite
Tests/GoodNetworkingTests/Services/TestingLogger.swift Removed GoodLogger dependency test utility
Tests/GoodNetworkingTests/Resources/*.json Test resource files removed
Tests/GoodNetworkingTests/Models/*.swift Test model files removed
Tests/GoodNetworkingTests/Endpoints/*.swift Test endpoint definitions removed
Sources/Mockable/ Mockable module completely removed
Sources/GoodNetworking/Session/NetworkSession.swift Core rewrite - replaced Alamofire with URLSession-based implementation
Sources/GoodNetworking/Utilities/ New utility classes: NetworkActor and AsyncLock for concurrency
Sources/GoodNetworking/Models/ New model definitions for URLConvertible, JSON, HTTPHeader, HTTPMethod
Sources/GoodNetworking/Interception/ New authentication and retry system replacing Alamofire interceptors
Sources/GoodNetworking/Logging/ Local logging system replacing GoodLogger dependency
Comments suppressed due to low confidence (1)

Sources/GoodNetworking/Session/NetworkSession.swift:262

  • The code uses preconditionFailure for encoding raw data into query parameters, but then logs an error message. This inconsistent error handling approach could lead to unexpected crashes versus graceful error handling.
                request.httpBody = try endpoint.parameters?.data()

@plajdo plajdo force-pushed the swift-6.2 branch 4 times, most recently from 65087c9 to 58c4a05 Compare August 12, 2025 14:12
plajdo and others added 11 commits August 12, 2025 16:40
# Conflicts:
#	Package.swift
#	Sources/GoodNetworking/Executor/DeduplicatingRequestExecutor.swift
#	Sources/GoodNetworking/Executor/RequestExecuting.swift
#	Sources/GoodNetworking/Providers/DeduplicatingResultProvider.swift
#	Sources/GoodNetworking/Providers/DefaultSessionProvider.swift
#	Sources/GoodNetworking/Session/LoggingEventMonitor.swift
#	Sources/GoodNetworking/Session/NetworkSessionConfiguration.swift
#	Sources/GoodNetworking/Wrapper/Resource.swift
+ new Endpoint url() default implmentation
@plajdo plajdo force-pushed the swift-6.2 branch 2 times, most recently from 481b0f6 to 245d27d Compare August 12, 2025 14:47
@marekVrican marekVrican self-requested a review August 14, 2025 15:57
@plajdo plajdo self-assigned this Aug 15, 2025
@plajdo plajdo added the enhancement New feature or request label Aug 15, 2025
@plajdo plajdo merged commit 781e523 into main Aug 15, 2025
@plajdo plajdo deleted the swift-6.2 branch August 15, 2025 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants