Sorry - but sending a bunch of static bytes through a TCP socket without even reading something from the input is not even a basic HTTP implementation.
It is therefore already vastly superior to any and all full web server and application server solutions and defines how servers will be written in the future.
Particularly, all the web server solutions written in Objective-C have ceased to exist.
I think this opens up the possibilities for Swift to be used as a web language, not just a iOS language. I have to say, Swift syntax is very similar to PHP 7. Interesting times for sure. I'll be keeping a close eye on Swift in terms of its adoption as a web language.
Swift has nothing similar to PHP 7. Typing in PHP 7 is ridiculous - you can set "Array" as a "strict" type of return value, but inside that array you can have whole universe. And any optional type system is not a type system at all. I learned it when tried Dart.
PHP 7 is too primitive in comparison with Swift.
Swift has a passable type system, support for generics, and doesn't use a VM.
Tooling support isn't there for Linux currently, so the act of writing code isn't much better than Python (no Xcode-type autocompletion), but once you want to run it, the compiler will scream at you if you pass ducks where penguins are expected - while still allowing you to reason about swimming birds in general.
Libraries on Linux and OS X just are different. Maybe when core libraries [0] will be fully finished we could just use `import Foundation` on both platforms.
Interesting to see if an Express like framework comes about. Does it even make sense to write a backend http RESTful API in Swift? Wonder what the performance is vs node.js and go?
It could be used as an example. In particular, the "builder" syntax that I did with a terrible TLS context hack could be replaced with autoclosures (I think).
Edit: more Sinatra-like than Express-like, but the idea still stands.
Here's one. https://github.com/PerfectlySoft/Perfect
Since work was started on this before Swift's open sourcing/linux support was added I doubt it compiles on linux just yet. I'm sure it'll be added though.
I don't think Swift is a very good choice for the web - we already have much better options. Swift compiler don't care about memory leaks, runtime errors and race conditions. And it's really easy to get runtime error - just unwrap optional value without check.
So I think Swift is good for something what can run few minutes and be restarted easily in case of failure - mobile and desktop apps. Not web server daemons.