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
Post a Comment