Error in try await URLSession.shared.data

I tried to compile the async/await for on swift-5.5-DEVELOPMENT-SNAPSHOT-2021-05-30-a-ubuntu20.04 but get this error. Is async/await available on Linux?

url.swift👨 4👨 6: error: type of expression is ambiguous without more context let (data, response) = try await URLSession.shared.data(from: url) ~~~~^~~~~~~~~~~~~~~~~~~~~





Replies

You should better use Code Block properly which improves readability and increases the chance to get better responses sooner.

But generally, Swift for Ubuntu cannot be the main topic of the dev forums. This site is mainly intended to discuss and share info about Apple's frameworks on Apple's platforms.

And the final Swift 5.5 is not released yet. Foundation types such as URLSession would be ported into Ubuntu, but it may not be the same time as the Swift 5.5 for Apple's platforms is released. You should better visit swift.org and get info about the status of Swift 5.5 for Ubuntu there.