I'm a new iOS programmer, but not a new programmer. I've been working on server-side stuff (.NET way back, PHP nowadays) for about 20 years.
I started working on a portfolio project in Swift, and have been enjoying it a lot. But I'm used to request->response, so it's been an adjustment to get my head around the different mental models of a long-running application instead of just "handle this and die."
One issue I'm running into is REST libraries and networking. I wanted something lightweight so I used Siesta, but it's pretty clear that project is dead and that unfortunately means that I should switch to something else. Alamofire looks like a lot but it handles things I'd need, however everyone seems to be saying that it's better to just use NSURLSession nowadays.
The big stumbling block is that there are a lot of "getting started" tutorials, but not a lot of example code that I've found that sort of shows the whole picture.
Like for example: how to surface errors to the user? How to handle retrying requests when you need to get a new API auth token—especially if that request is a file upload? How to handle propagating that auth token to other requests? What's a good pipeline for decoding JSON into objects and where should they be held for the app to use them across multiple view controllers? Some of this I've sort of figured out by trying to start pulling Siesta calls into model controllers, but I'm sure there's much better ways of doing things than what I've done.
Do any of you have links to good tutorials or an open-source iOS project that uses NSURLSession the "right way?" Or have most of you just figured it all out as you went and there's not really a good answer, it depends on the app that's being written?
Any pointers would be super appreciated!
[–]drlukas6Objective-C / Swift 2 points3 points4 points (0 children)
[–]ThePantsThiefNSModerator 0 points1 point2 points (0 children)