Alamofire on Linux: Getting Closer

Previously: Alamofire on Linux.

With the release of Swift 5.4 it looks like Foundation on Linux is in a good enough place to make an Alamofire port much easier than it was in the past. Since @SlaunchaMan was recently abducted by the mothership and because the changes are much simpler now, this work has been redone and resides on the feature/linux-support branch and is tracked as PR #3446.

I've tested an executable using the branch can successfully make a request on Linux. There are currently only a few remaining pieces of functionality that need to be replaced.

  • Stream.getBoundStreams doesn't exist in swift-corelibs-foundation.
  • MIME type detection to replace the use of UTTypeCreatePreferredIdentifierForTag and UTTypeCopyPreferredTagWithClass.
  • The NSURLSessionDownloadTaskResumeData key for URLError.userInfo doesn't exist in swift-corelibs-foundation.
  • URLAuthenticationChallenge handling is disabled pending a refactor to work around none of the Security types being available on Linux.

Surprisingly, that's it! I still need to port the test suite over, which will likely involve support test resources as well a getting a Linux build of the Firewalk test server, but we're closer than ever before.

If anyone tries this out, please report issues here and not on our GitHub, at least until we're officially shipped.

7 Likes
Terms of Service

Privacy Policy

Cookie Policy