GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - allenhsu/NSDictionary-Accessors: Type safe accessors for NSDictionary, better used with dictionary parsed from JSON.

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
NSDictionary+Accessors.h
NSDictionary+Accessors.h
 
 
NSDictionary+Accessors.m
NSDictionary+Accessors.m
 
 
NSDictionary+Accessors.podspec
NSDictionary+Accessors.podspec
 
 
README.md
README.md
 
 

Repository files navigation

NSDictionary-Accessors

Type safe accessors for NSDictionary, better used with dictionary parsed from JSON.

Before:

id value = nil;
value = [dictionary objectForKey:@"id"];
if ([value isKindOfClass:[NSNumber class]]) {
    model.identifier = [value unsignedLongLongValue];
}
value = [dictionary objectForKey:@"title"];
if ([value isKindOfClass:[NSString class]]) {
    model.title = value;
}
value = [dictionary objectForKey:@"content"];
if ([value isKindOfClass:[NSString class]]) {
    model.content = value;
}

Problems:

  • Boilerplate code
  • 64bit ids will be returned as string instead of number in some api
  • Libs like RestKit even lighter JSONModel are still heavy for simple apps sometimes

What you need is just AFNetworking + NSDictionary+Accessors

After:

model.identifier = [dictionary unsignedLongLongForKey:@"id"];
model.title = [dictionary stringForKey:@"title"];
model.content = [dictionary stringForKey:@"content"];

About

Type safe accessors for NSDictionary, better used with dictionary parsed from JSON.

Resources

Readme
MIT license
Activity

Stars

61 stars

Watchers

1 watching

Forks

10 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.