In this Alamofire tutorial, you'll learn how to build an iOS app with Swift that sends & receives data to a remote API via HTTP using the Alamofire library.
Thanks for the tutorial. I’ve been working with Alamofire since it’s beginning. But creating the router was new to me. I will surely make use of that in my future projects.
Thanks so much for this very Nice Tutorial.
Actually I revised a lot of Swift skills because of this tutorials and write downed them in Text file.
I can send it to you if you want, just send me your email.
my email is: ahmad.3atef@gmail.com
I’ll use Router concept in my next swift code, specially in Business Logic Layer as I was using it in Objective C.
For some beginners like me could you please add a delay i found it helpful before performing the segue
i used the code below it helped me to better understand the interactions
Hi, this might be a bit of topic, but here goes:
I have developed an app where an admin user can controll the app content (text, pictures, events etc) from a backend/CMS system. However the transfer of the data does not take place untill the user opens the app (every time the app is opened it goes to the backend to look for updates). I would like to push the data immediately so the user do not have to wait for the download to take place when the app is opened. So my question is how: Can I force the data to the app immediately after a backend update? I think it could be implemented with a special type of push messages that will trigger the app to search the backend for updates, but I would like to hear you if you have other ideas for how this functinality can be implemented?
Thanks
Claus
Hi Claus - Yeah that’s a little off topic but I don’t mind giving you some direction. You are correct, background push notifications with fetch is the right way to go. You can also configure your app to do a scheduled background fetch but the interval is not guaranteed by iOS and is dependent on a lot of conditions you have no control over. I’d look into implementing a push notification with background fetching. Do remember that the user can shut off background fetch for your app so make sure you don’t make the app completely contingent on this feature.
I can update the code to include [weak self] - it looks like at some point [unowned self] is used in the uploader which could crash if self is nil. The chance of a leak happening in the example is pretty minimal but I’ll update it for those using the example code as a basis for their own projects.
I had some trouble with the tutorial, though, probably because I lean a little newb. The location of where to put this code wasn’t immediately clear:
Next, add the following code to upload.responseJSON:
I think it would be clearer to say: Next, add the following code after “upload.responseJSON { response in” or similar verbiage.