Alamofire: Add server / linux support once Swift 3 is released

Created on 4 May 2016  路  9Comments  路  Source: Alamofire/Alamofire

There is a need to run Alamofire on Open Swift server platforms

Most helpful comment

We're certainly very interested in this possibility! Once we get closer to seeing exactly how the linux Foundation is implemented, we'll start investigating how we'll need to modify Alamofire to support it.

Cheers. 馃嵒

All 9 comments

We're certainly very interested in this possibility! Once we get closer to seeing exactly how the linux Foundation is implemented, we'll start investigating how we'll need to modify Alamofire to support it.

Cheers. 馃嵒

Development of Swift 3 is almost finished and dispatch/NSURLSession will be supported on Linux. It would be great to start considering working on the possibility to port Alamofire to Linux.

Any news on the development of the above function?

agree any news?

I subclassed the swift 3 docker container and added a sshd daemon / zsh
https://gist.github.com/johndpope/01a74ffb93921df48e334097117be1b3
screen shot 2016-10-21 at 16 13 39

As the trend of backend development is to go microservices - swift will likely find it's niche / foothold there.

UPDATE - so after some faffing around - running with above swift3 ubuntu docker container and patching Package.swift to 4.0.2 tag ->

I get ....
/tmp/SPMTester/Packages/Alamofire-4.0.2/Source/NetworkReachabilityManager.swift:28:8: error: no such module 'SystemConfiguration'
screen shot 2016-10-20 at 18 05 44

One shot script to download + patch alamofire run from inside docker container...
eg.

wget https://gist.githubusercontent.com/johndpope/e590169f7a0aaf08e52ba25a75bcd8d1/raw/5f1a3743e61224f7ae7963d4c61d79a5233c531f/cloneAlamofire.sh
chmod +x cloneAlamofire.sh

screen shot 2016-10-21 at 14 25 44
https://gist.github.com/johndpope/e590169f7a0aaf08e52ba25a75bcd8d1

with my docker container + ssh - you can then simply configure cyberduck to edit files in container. N.B. rather than version bumping package each time to test - you can fork and update script above to point your own files - blow away stuff and recompile.

I added code to bypass systemconfiguration
https://gist.githubusercontent.com/johndpope/b09b4560d7a91b638c4ffab356be3516/raw/e3e8f6cb6ac6f8f9706c196a9c100c0a330a488d/NetworkReachabilityManager.swift

but looks like there's wider troubles now
error: use of undeclared type 'NetService'
error: use of undeclared type 'DispatchQueue'

still digging...
https://gist.github.com/johndpope/5d619cd851613515db767c28feeb7105

tried adding import Dispatch - but no joy.

As an alternative - probably safest to go with vapor
https://vapor.github.io/documentation/http/client.html

This Edge framework seems like another nice alternative to alamofire for server side swift https://github.com/SwiftOnEdge/Edge

so this looks blocked until Apple implement NSURLSession - shared
http://stackoverflow.com/questions/38419999/swift-3-preview-2-linux-error-use-of-unresolved-identifier

One path forward could be to use libcurl -
IBM has libcurl c wrapper in swift for linux - and someone recently made a swifty wrapper for this.
https://github.com/dmcyk/SwiftyCurl

Suggestion: we should move this discussion to #1935

Yes, all Linux discussion is now in #1935.

Was this page helpful?
0 / 5 - 0 ratings