YOLOKit
Fast development with this nice library for manipulating data in various ways;

seen from United Kingdom

seen from United Kingdom
seen from Martinique
seen from South Africa

seen from Germany

seen from Malaysia

seen from United States
seen from Hong Kong SAR China
seen from United States
seen from China

seen from Malaysia

seen from United States
seen from Poland

seen from Malaysia
seen from United States
seen from China
seen from United States

seen from United Kingdom
seen from Hong Kong SAR China
seen from China
YOLOKit
Fast development with this nice library for manipulating data in various ways;
Cách đơn giản nhất để parsing nested dictionary
Giả sử bạn làm việc với một API có kết quả trả về như sau:
{ "created_at": "2013-05-25T03:39:05Z", "num_stars": 0, "num_replies": 0, "source": { "link": "http://riposteapp.net", "name": "Riposte", "client_id": "737a54nLCdLLutcs2VzhtNKGnnMrakc4" }, "text": "We need new rules for using acronyms. If googling an acronym does not find it in the first few links, you should spell it out instead.", "num_reposts": 0, "id": "6027821", "entities": { "mentions": [], "hashtags": [], "links": [] }, "html": "We need new rules for using acronyms. If googling an acronym does not find it in the first few links, you should spell it out instead.", "machine_only": false, "user": { "username": "jrinn", "avatar_image": { "url": "https://d2rfichhc2fb9n.cloudfront.net/image/5/eGiW2i1Ziwn9i1YyM5jE99Wwat97InMiOiJzMyIsImIiOiJhZG4tdXNlci1hc3NldHMiLCJrIjoiYXNzZXRzL3VzZXIvZGQvMDIvMzAvZGQwMjMwMDAwMDAwMDAwMC5qcGciLCJvIjoiIn0", "width": 200, "is_default": false, "height": 200 }, "description": { "text": "iPhone app developer and father.", "html": "iPhone app developer and father.", "entities": { "mentions": [], "hashtags": [], "links": [] } }, "locale": "en_US", "created_at": "2013-04-02T06:23:09Z", "canonical_url": "https://alpha.app.net/jrinn", "cover_image": { "url": "https://d2rfichhc2fb9n.cloudfront.net/image/5/kZ-JRmTbmd3WVPswTJ8Nwxzkf917InMiOiJzMyIsImIiOiJ0YXBwLWFzc2V0cyIsImsiOiJpL1UvaS9ZL1VpWW5xRFNvTUtyTEhLNXA0OHN2NkxmTmRVMC5qcGciLCJvIjoiIn0", "width": 960, "is_default": true, "height": 260 } } }
Bạn muốn lấy giá trị của avatar url, thông thường sẽ viết như sau:
NSString *url = [[[dictionary objectForKey:@"user"] objectForKey:@"avatar_image"] objectForKey:@"url"];
Nhìn code hơi dài, bạn có thể tận dụng NSKeyValueCoding protocol và viết ngắn gọn hơn như sau:
NSString *url = [dictionary valueForKeyPath:@"user.avatar_image.url"];
Fixed for each loop in objective c for accessing NSMutable dictionary #dev #it #asnwer
Fixed for each loop in objective c for accessing NSMutable dictionary #dev #it #asnwer
for each loop in objective c for accessing NSMutable dictionary
I am finding some difficulty in accessing mutable dictionary keys and values in Objective-C.
Suppose I have this:
NSMutableDictionary *xyz=[[NSMutableDictionary alloc] init];
I can set keys and values. Now, I just want to access each key and value, but I don’t know the number of keys set.
In PHP it is very easy, something as…
View On WordPress
Fixed Difference between objectForKey and valueForKey? #dev #it #asnwer
Fixed Difference between objectForKey and valueForKey? #dev #it #asnwer
Difference between objectForKey and valueForKey?
What is the difference between objectForKey and valueForKey? I looked both up in the documentation and they seemed the same to me.
Answer: Difference between objectForKey and valueForKey?
Here’s a great reason to use objectForKey: wherever possible instead of valueForKey: – valueForKey: with an unknown key will throw NSUnknownKeyExceptionsaying…
View On WordPress
Fixed How to check if an NSDictionary or NSMutableDictionary contains a key? #dev #it #asnwer
Fixed How to check if an NSDictionary or NSMutableDictionary contains a key? #dev #it #asnwer
How to check if an NSDictionary or NSMutableDictionary contains a key?
I need to check if an dict has a key or not. How?
Answer: How to check if an NSDictionary or NSMutableDictionary contains a key?
objectForKey will return nil if a key doesn’t exist.
Answer: How to check if an NSDictionary or NSMutableDictionary contains a key?
if ([mydict objectForKey:@"mykey"]) { // key exists. } else { //…
View On WordPress
How to: Best practice? - Array/Dictionary as a Core Data Entity Attribute
How to: Best practice? – Array/Dictionary as a Core Data Entity Attribute
Best practice? – Array/Dictionary as a Core Data Entity Attribute
I am new to Core Data. I have noticed that collection types are not available as attribute types and would like to know what the most efficient way is of storing array/dictionary type data as an attribute (e.g. the elements that make up an address like street, city, etc. does not require a separate entity and is more conveniently…
View On WordPress
How to: How to use NSJSONSerialization
How to use NSJSONSerialization
I have a JSON string (from PHP’s json_encode() that looks like this:
[{"id": "1", "name":"Aaa"}, {"id": "2", "name":"Bbb"}]
I want to parse this into some sort of data structure for my iPhone app. I guess the best thing for me would be to have an array of dictionaries, so the 0th element in the array is a dictionary with keys "id" => "1" and "name" => "Aaa".
I do…
View On WordPress