Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jason Cornwall
9,645 PointsMust You Write Networking Code From Scratch Every Time?
When a developer wants to integrate an API into their app, do they have to write all the networking code, including getting the JSON and parsing it, every single time from scratch? This seems like it would be a bit time consuming and difficult as well.
1 Answer
Martin Wildfeuer
Courses Plus Student 11,071 PointsYou are right, most developers wouldn't write their networking code over and over again. The more generic you keep your networking code, the more likely it is that it can be used with other apps, regardless what kind of app. You could simply drag & drop your existing networking classes to one of these project and use it there.
After all, you might end up creating your own library/framework and pull that into your projects.
In case of networking, you might also want to use one of the established open source libraries like Alamofire. These are well maintained and offer great features and functionality right out of the box. Dependency managers like CocoaPods, Carthage or the upcoming Swift Package Manager make it easy to integrate third party libraries into your app.
Hope that helps :)