Creates a task that retrieves the contents of the specified URL, then calls a handler upon completion.
Declaration
func dataTask(with url: URL, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
The dataTask method passed back 3 values, all of which are optional - Data?, URLResponse?, and Error?.
developer.apple.com/documentation/foundation/urlsession/1410330-datatask
Apple Developer Documentation
developer.apple.com
'Programming > Swift' 카테고리의 다른 글
Class: UserDefaults (0) | 2020.11.10 |
---|---|
Class: JSONSerialization (0) | 2020.11.09 |
NSError & CocoaError (0) | 2020.11.06 |
Error (0) | 2020.11.06 |
Protocols (0) | 2020.11.06 |