خرید بک لینک

Vote count: 0

I've read a lot of topics about Swift Json parsing but as the result I found unpredictable behaviour. E.g., for this code:

if let city = cities[ndx] as? [String: AnyObject],
                let population: UInt64 = (city["population"] as? NSNumber)!.unsignedLongLongValue  {
                if (population > 0) {

                    if let name = city["name"] as? String,
                        let lat: Double = Double((city["lat"] as? String)!),
                        let lon: Double = Double((city["lng"] as? String)!),
}
}

to retrieve integer value I have to use AnyObject > NSNumber > UInt64 conversion but for double value: AnyObject > String > Double.

Is it usual behaviour for all devices? Are there any other stange conversions while using NSJSONSerialization.JSONObjectWithData?

asked 13 secs ago

برچسب: swift json parsing,swift json parsing library,swift json parsing array,swift json parsing github,swift json parsing tutorial,swift json parsing ios,swift parsing json string,swift json parse int,swift json parser tutorial,swift json parser github, نویسنده: استخدام کار تاريخ: چهارشنبه 24 شهريور 1395 ساعت: 14:40

صفحه بندی