Hacker News new | past | comments | ask | show | jobs | submit login
Building REST APIs on Linux with Swift and Zewo (iachieved.it)
13 points by jaxondu on Dec 25, 2015 | hide | past | favorite | 3 comments



This is cool but I think it's misleading to say that Swift is a good option for starting a web backend project _today_, at least for anything that's not hobby work. The folks at Apple update the dev builds so frequently that in my experience it breaks things often enough that you'll spend 50% of your time updating your code for a new build or waiting for dependencies to update their code.

And just to be clear I think that's awesome. I love the work they're doing; it's just time consuming. I've been writing my own approach to a Swift MVC framework so this is something I'm experiencing firsthand:

Swerver: https://github.com/jparishy/swerver (example usage: https://github.com/jparishy/swerverorg - it's based on libuv and makes many choices for you a la Rails compared to the framework demoed in the OP)

and it has been way more time consuming that I would have expected going into it. And right now it doesn't build on Linux because the latest Apple build broke something in CryptoSwift, which Swerver depends on.

All that said, Swerver has been super fun to work on so. After a lot of the hard work had been done, the actual usage (as demoed in jparishy/swerverorg with user authentication, client-side session state, and the basic MVC/DB access stuff) has been really smooth and enjoyable. /shamelessplug


This is cool. We need more projects like this.

But, there are some big issues in this code.

First, you are constructing SQL with string interpolation. Never do this, not even in sample code. People will blindly copy.

Second, way too much unsafe code. Why all the try! and explicit unwraps? Swift has all these great safety nets. Why let your code crash with unhandled exceptions while you can also properly deal with them?


I'll be that guy again... this isn't REST.

That said, glad people are starting to explore Swift for backend development.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: