EGYBlogPost 1.0.1

EGYBlogPost 1.0.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.


Downloads

Total4
Week0
Month0

Installs

Apps1
powered by Segment

GitHub

Stars1
Watchers1
Forks0
Issues0
Contributors1
Pull Requests1

Code

Files2
LOCLines of Code 37


  • By
  • Mokhlas Hussein

EGYBlogPost Easy Way To Fetch Blogs Posts Using json.

Cocoapods

  • pod 'EGYBlogPost'

Usage

NSURL *EGYBlog = [NSURL URLWithString:@"JSON-API-URL"];

NSData *EGYJSON = [NSData dataWithContentsOfURL:EGYBlog];

NSError *ERROR = nil;

NSDictionary *dataDictionary = [NSJSONSerialization JSONObjectWithData:EGYJSON options:0 error:&ERROR];

NSMutableArray *EGYBLOGPOSTS = [NSMutableArray array];

NSArray *blogPostsArray = [dataDictionary objectForKey:@"posts"];

for (NSDictionary *bpDictionary in blogPostsArray) {
    EGYBlogPost *blogPost = [EGYBlogPost egyBlogPostWithTitle:[bpDictionary objectForKey:@"title"]];
    blogPost.author = [bpDictionary objectForKey:@"author"];
    blogPost.thumbnail = [bpDictionary objectForKey:@"thumbnail"];
    blogPost.date = [bpDictionary objectForKey:@"date"];
    blogPost.url = [NSURL URLWithString:[bpDictionary objectForKey:@"url"]];
    [EGYBLOGPOSTS addObject:blogPost];

Credits

EGYBlogPost is brought to you by Mokhles Hussien @iMokhles