sffsf sffsf - 1 year ago 106
Swift Question

Swift2 check array in dictionary

I am trying to create case in one line but I can not find how can I do that

I need to write that code in one line

if let holdings = i["holdings"] as Array where !holdings.isEmpty {

any ideas?

ohr ohr
Answer Source

AnyObject since your didn't specify what was inside your array.

if let holdings = i["key"] as? [AnyObject] where !holdings.isEmpty


if let holdings = i["key"] as? Array<AnyObject> where !holdings.isEmpty
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download