# Use the official Swift image from the Docker Hub
FROM swift:5.10
# Set a working directory inside the container
WORKDIR /app
# Copy the Package.swift and Sources directory into the container at /app
COPY Package.swift ./
COPY Sources ./Sources
# Build the Swift package
RUN swift build
# Run the executable produced by the build
CMD ["swift", "run", "SomeFile"]
2.409 /app/Sources/MyFile.swift:34:57: error: value of type 'URLSession' has no member 'data'
2.409 let (data, _) = try await URLSession.shared.data(for: request)
2.409 ~~~~~~~~~~~~~~~~~ ^~~~
Corelibs foundation is a different implementation on Linux currently, and it has many missing APIs. So what youāre experiencing is a different library on Linux not having the api you expect.
Thereās an active process to resolve this weird situation by implementing foundation in swift which is over here: GitHub - apple/swift-foundation: The Foundation project and then both platforms will be using the exact same implementation, resolving the issue youāve hit.