Swift XML attribute

Hello! Could you please help me with a Swift XML problem?

I have this xml: http://kissmjt.gr/AirPlayHistory.xml

How can I show on a Swift App the last songs from this XML? The song name and the artist are written as an attribute on the xml.

How can I show the song names and the artists from a XML attribute?


Thank you!

Replies

How can I show on a Swift App the last songs from this XML?

You need to break this problem up into pieces:

  1. downloading the XML data

  2. parsing that into a set of model objects

  3. displaying those model objects in a table view

With regards step 1, you should take a look at URLSession (NSURLSession in Objective-C). You can find a bunch of docs and examples for that.

With regards step 2, I responded to your earlier thread with an XML example. Did you try that? What did you experience?

With regards step 3, UI isn’t really my thing so I’ll let others answer.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"