Skip to content

Commit

Permalink
chore: remove urlSession getter from interface
Browse files Browse the repository at this point in the history
  • Loading branch information
gajddo00 committed Feb 3, 2025
1 parent 856d1fc commit 9565124
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 5 additions & 4 deletions Sources/Networking/Core/APIManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ open class APIManager: APIManaging, Retryable {

internal var retryCounter = Counter()

var urlSession: URLSession? {
responseProvider as? URLSession
}

public init(
urlSession: URLSession = .init(configuration: .default),
requestAdapters: [RequestAdapting] = [],
Expand Down Expand Up @@ -111,12 +115,9 @@ public extension APIManager {
_urlSessionIsInvalidated
}

var urlSession: URLSession? {
responseProvider as? URLSession
}

func setUrlSession(_ urlSession: URLSession) {
responseProvider = urlSession
_urlSessionIsInvalidated = false
}

func invalidateUrlSession() async {
Expand Down
3 changes: 0 additions & 3 deletions Sources/Networking/Core/URLSessionInvalidatable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import Foundation

/// Adds capability for `URLSession` to be invalidated and recreated.
public protocol URLSessionInvalidatable {
/// Invalidates urlSession to gracefully clear out all its tasks.
var urlSession: URLSession? { get }

/// Returns `true` if session has been invalidate and is no longer suitable for usage.
/// Any other usage of this urlSession will lead to runtime error.
var urlSessionIsInvalidated: Bool { get }
Expand Down

0 comments on commit 9565124

Please sign in to comment.