Skip to content

Instantly share code, notes, and snippets.

@kesar
Created July 23, 2015 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kesar/6b8273e05005f6ba53d3 to your computer and use it in GitHub Desktop.
Save kesar/6b8273e05005f6ba53d3 to your computer and use it in GitHub Desktop.
builder swift
// Api.swift
Api().getFeedItems { (FeedItems) -> () in
// do something with [FeedItem]
}
// inside of getFeedItems
FeedItem = FeedItemFactory.FeedItemFromJSON(feedItemJSON)
// inside of FeedItemFactory.FeedItemFromJSON (I use SwiftyJSON)
let feedItem = FeedItem()
if let id = feedItemJSON["id"].int {
feedItem.id = id.toInt()!
}
...
return feedItem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment