Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: RobotsAndPencils/AsyncHTTPNetworkService
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: XcodesOrg/AsyncHTTPNetworkService
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Jan 31, 2025

  1. Copy the full SHA
    a5c8e3c View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b27dc27 View commit details

Commits on Feb 4, 2025

  1. try preconcurrency macro

    MattKiazyk committed Feb 4, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    12e225a View commit details
4 changes: 2 additions & 2 deletions AsyncNetworkService.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -573,7 +573,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = PBH8V487HB;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -602,7 +602,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = PBH8V487HB;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
9 changes: 6 additions & 3 deletions AsyncNetworkService/AsyncHTTPNetworkService.swift
Original file line number Diff line number Diff line change
@@ -24,22 +24,25 @@ public protocol AsyncNetworkService: AnyObject {
func requestData(_ request: ConvertsToURLRequest, validators: [ResponseValidator]) async throws -> (Data, URLResponse)
}

public class AsyncHTTPNetworkService: AsyncNetworkService {
@preconcurrency
public final class AsyncHTTPNetworkService: AsyncNetworkService, Sendable {
public var requestModifiers: [NetworkRequestModifier]
public var responseInterceptors: [NetworkResponseInterceptor]

private let urlSession = URLSession(configuration: .ephemeral)
public private(set) var urlSession: URLSession

public var errorHandlers: [AsyncNetworkErrorHandler] = []

public init(
requestModifiers: [NetworkRequestModifier] = [],
errorHandlers: [AsyncNetworkErrorHandler] = [],
reponseInterceptors: [NetworkResponseInterceptor] = []
reponseInterceptors: [NetworkResponseInterceptor] = [],
urlSession: URLSession = URLSession(configuration: .ephemeral)
) {
self.requestModifiers = requestModifiers
self.errorHandlers = errorHandlers
self.responseInterceptors = reponseInterceptors
self.urlSession = urlSession
}

private func applyModifiers(to request: ConvertsToURLRequest) -> URLRequest {
2 changes: 1 addition & 1 deletion AsyncNetworkService/Common/NetworkRequestModifier.swift
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
import Foundation

/// Represents a type that adds persistent details to a URL Request. (Ex: adding headers with authentication)
public protocol NetworkRequestModifier {
public protocol NetworkRequestModifier: Sendable {
/// Add authentication details to a URL Request (for example, by adding authentication headers)
///
/// - returns: The modified URL Request