URLSession
public extension URLSession
-
Returns a task for fetching and parsing articles specified by provided request.
The completion handler takes a single
Resultargument, which is either a succesfuly parsedArxivResponseor an error, if one occurs. The error is eitherArxivURLError,ArxivServerError,ArxivParserErrororArxivAPIError.Note
Completion handler is called on session’sdelegateQueue.Declaration
Swift
func fetchTask(with request: ArxivRequest, completion: @escaping ArxivFetchTaskCompetionHandler) -> URLSessionDataTaskParameters
requestAn
ArxivRequestvalue that specifies the articles to be fetched by the task.completionA function to be called after the task finishes.
-
arxivResponse(for:Asynchronousdelegate: ) Downloads and parses articles specified by provided request and delivers the result asynchronously.
Throws
An error which is either
ArxivURLError,ArxivServerError,ArxivParserErrororArxivAPIError.Declaration
Swift
@available(macOS 12.0.0, iOS 15.0.0, *) func arxivResponse(for request: ArxivRequest, delegate: URLSessionTaskDelegate? = nil) async throws -> ArxivResponseParameters
requestAn
ArxivRequestvalue that specifies the articles to be fetched asynchronously.delegateA delegate that receives life cycle and authentication challenge callbacks as the transfer progresses.
-
Returns a task for fetching and parsing articles specified by provided request.
When the task completes, a result is assigned to property indicated by
keyPathon the provided object.The result is either a succesfuly parsed
ArxivResponseor an error, if one occurs. The error is eitherArxivURLError,ArxivServerError,ArxivParserErrororArxivAPIError.Note
The assignment happens on session’sdelegateQueue.Declaration
Swift
func fetchTask<Root>( with request: ArxivRequest, assignResultTo keyPath: ArxivFetchResultKeypath<Root>, on object: Root ) -> URLSessionDataTaskParameters
requestAn
ArxivRequestvalue that specifies the articles to be fetched by the task.keyPathA key path that indicates the property to assign.
objectThe object that contains the property.
URLSession Extension Reference