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!

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

iOS

XML or JSON in Swift Development?

Hi there, I am currently going through the Swift courses under the IOS development track.

I am working towards building apps that communicate back and forth with web-servers, and in the past have always used XML as my primary data transport.

I'm wondering if its time to rethink wether to continue providing server data to apps as XML, or is it more appropriate to adopt JSON? (I'm new to JSON as well)

I'm hoping to make sure to follow a good practice, and am thinking that XML is more structured (even though there is some data overhead) but from what I've seen so far, it seems that in Xcode, Swift and apple environments, JSON is more widely supported.

Any advice or suggestions are greatly appreciated - also if there is any specific courses I should review that relate to this topic that would be a huge help as well!

Thanks in advance! Ted

2 Answers

Hi Ted,

Check out the course "Build a Weather App with Swift". It covers both network calls and JSON.

That's great - just started that course and so far it seems very helpful. However they don't mention XML; is there anything that talks about using XML in a mac/ios environment?

Coming from my experience in the Microsoft paradigm (.net etc.) where XML was drilled into me, it strangely feels like XML is completely ignored on the apple side.

Either that, or is JSON really what devs are focusing on going forward?

Opinions are much appreciated!

Many of the API's that I have worked with use JSON. The very first app I created I used XML and I regret it. However, with that said I think you will find that each have their pros and cons. Check out this post at stackoverflow