ios - Proper way to parse with SwiftyJSON -


i'm using swityjson iterate through json data , parse it. it's working fine, make sure i'm using syntax correctly , efficiently. please review code below:

                if let itemdict = json[0]["artists"].dictionaryvalue {                     item in itemdict {                         if let artist: dictionary? = item.1.dictionaryvalue {                             // artist id                             if let artistid = artist?["id"] {                                 if artistid.stringvalue != nil {                                     // add value object                                 }                             }                             // title                             if let title = artist?["title"] {                                 if title.stringvalue != nil {                                     // add value object                                 }                             }                             // subtitle                             if let subtitle = artist?["subtitle"] {                                 if subtitle.stringvalue != nil {                                     // add value object                                 }                             }                             // image url                             if let imageurl = artist?["imageurl"] {                                 if imageurl.stringvalue != nil {                                     // add value object                                 }                             }                         }                     }                 } 

this new ray wenderlich has provided tutorial. try learn it. helped me lot.


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -