-
Notifications
You must be signed in to change notification settings - Fork 1
Swift 6.2 & GoodNetworking 4.0 #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
marekVrican
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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()
GoodNetworking-Sample/GoodNetworking-Sample/Managers/SampleNetworkSessions.swift
Show resolved
Hide resolved
65087c9 to
58c4a05
Compare
# 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
481b0f6 to
245d27d
Compare

## Migration guide:
import Alamofireand@preconcurrency import AlamofireBaseUrlProviderwithURLConvertiblefunc resolveBaseUrl() async -> String?->func resolveUrl() async -> URL?(in URL providers)func url(on baseUrl: String) throws -> URLin Endpoints withfunc url(on baseUrl: any URLConvertible) async -> URL?or remove the function completely where default implementation is sufficient. Replacethrow-s withreturn nil.var path: String {withvar path: URLConvertible {andimport GoodNetworkingwhere required. Take care not to replace unrelated implementations.URL(string:)AuthenticatorInterceptors with new, simplerAuthenticatorprotocolNetworkError:local(network failure),remote(Invalid HTTP status code, server errors) anddecoding(decoding failures).