Hello everyone. I want to discuss one theme, that, I believe, will be interesting to all who loves Apple products and doings in development sphere. A lot of applications nowadays are client-server (to say the truth, I think more then 50%). I also want to create my own client-server application. Of course, I will use Swift for this for client part. But, what to do with server part? I don’t know any of server languages like PHP or Python or some others. And, more over, I don’t want to learn them. But, I heard, that it is possible to create server part on any language, even on Swift. So discussion will be about this: is is possible to create OS X Server (or buy a hosting with latest version), write a program and it will response on requests from client (replies with JSON, send SMS when needed and etc.)? And one more addition: is it possible to do it absolutely native way? I mean without third parties frameworks, only Apple products. Thanks to everyone who will join to discussion 🙂
Server part on Swift
For Swift on the server side, take a look at IBM's offering:
www.ibm.com/cloud-computing/bluemix/swift/
My guess is that Microsoft will soon (6-12 months) add Swift to Visual Studio, enabling Swift-based Azure servers.
I'm not sure it's any easier to stick with OS X Server, because any OS X APIs you rely on will likely not scale as well as the APIs of the mainstream providers such as Microsoft and IBM. But that remains to be seen.
Also, check out this swift-users thread, which has a bunch of useful links and advice.
As QuinceyMorris pointed out, the folks at IBM are heavily invested in server-side Swift. They recently presented a talk on their work that, not being from that world, I found most interesting.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
Guys, first of all, thank you for yours replies. But question was how to do this with native Apple technologies. And is it even possible?
Yours information is also very helpful, but not Microsoft, not IBM can be count as native to Apple. And more over, they are not even ready, as I understand…
On an OS X server, you can go with with established HTTP service like Apache, but you are (at least for now) going to have write some kind of interface module to be able to integrate Swift code. Or, you can write your own HTTP service (there is source code for this sort of thing on, say, Github, which you could translate into Swift), and add whatever server-side processing your situation requires.
So, yes, a pure OS X + Swift server solution is functionally possible now. But the problem is that this will only be good for low transaction rates. For higher volumes, you need scalability (load balancing, etc) and writing that sort of thing from scratch in Swift is going to be a challenge (not to mention time-consuming).
My point in mentioning IBM and Microsoft is that, on the server side, (IMO)infrastructure is a more important consideration than your preference for APIs. Use the wrong language, and you'll be unhappy for a while during implementation. Use the wrong infrastructure, and you'll be unhappy forever.
Still in general agreement with QuinceyMorris here, but I wanted to ask you about this:
But question was how to do this with native Apple technologies.
What do you consider native Apple technologies? My specific concern here is web serving. Apple does not have a (public) HTTP server API, so your options are:
use the Apache built in to OS X [Server]
install your own Apache, nginx, or whatever
use a third-party HTTP server library
write your own HTTP server library based on Cocoa APIs
write your own HTTP server library based on BSD Sockets APIs
Which of these would you consider native Apple technologies?
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
Sorry guys for answering too slow. Is is a great discussion we have! 😎
Ok, sounds scary. Of course so tricky task will be too difficult for me. But I think I don't need balance loader, at least in the beginning. Maybe another hard to realize features too. How do you think, where to find a tutorial?
Sorry guys for answering too slow. Is is a great discussion we have! 😎
I think I will answer to your question: deploying Mac OS X Server and make it response on https requests will be more then enough. This is option one I believe! I just need to figure out how to do this!
Apple does not provide any infrastructure for deploying web apps on OS X Server, in Swift or any other language. You could do this by piggybacking on top of the infrastructure that OS X Server uses for its own features (Apache, basically) or you could deploy your own HTTP server. I don’t have a lot of experience doing either, but I will say that OS X does not provide any high-level HTTP server APIs, so if you want to deploy your Swift code in an HTTP server written in Swift then you’ll need to either write that part yourself or take advantage of some third-party library.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
WWDC runs Mon, 13 Jun through to Fri, 17 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face. http://developer.apple.com/wwdc/