haydarKarkin provided an answer to this in a GitHub comment. The following code snippets are copied directly from its comment.
You can create a custom configuration for the Moya provider by creating a custom Alamofire session manager:
import Foundation import Alamofire class DefaultAlamofireManager: Alamofire.SessionManager { static let sharedManager: DefaultAlamofireManager = { let configuration = URLSessionConfiguration.default configuration.httpAdditionalHeaders = Alamofire.SessionManager.defaultHTTPHeaders configuration.timeoutIntervalForRequest = 20
Then add the Alamofire user manager when declaring your provider:
let Provider = MoyaProvider<GithubAPI>(endpointClosure: endpointClosure, manager: DefaultAlamofireManager.sharedManager, plugins: [NetworkActivityPlugin(networkActivityClosure: networkActivityClosure)])
source share