Created
May 7, 2022 14:29
-
-
Save ankittlp/b3c063c6c05354f64a1ca1e82818f025 to your computer and use it in GitHub Desktop.
URLSessionDataTaskPublisher_basic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let urlSessionPublisher = URLSession.shared.dataTaskPublisher(for: url)//.map { $0.data } | |
let subscription = urlSessionPublisher.sink(receiveCompletion: { (error) in | |
print("error \(error)") | |
}) { (data,response) in | |
print("Data \(String(data: data, encoding: .utf8)) - Response - \(response)" ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment