mirror of
https://github.com/ProxymanApp/atlantis.git
synced 2026-05-20 20:20:35 +00:00
21 lines
525 B
Swift
21 lines
525 B
Swift
|
|
import Foundation
|
|
#if os(iOS) || os(macOS)
|
|
import class AVFoundation.AVAggregateAssetDownloadTask
|
|
#endif
|
|
|
|
extension URLSessionTask {
|
|
var currentRequestSafe: URLRequest? {
|
|
// If sessionTask is AVAggregateAssetDownloadTask,
|
|
// accessing currentRequest crashes with not supported error,
|
|
// so we need to check for it in advance.
|
|
#if os(iOS) || os(macOS)
|
|
if self is AVAggregateAssetDownloadTask {
|
|
return nil
|
|
}
|
|
#endif
|
|
|
|
return currentRequest
|
|
}
|
|
}
|