{"action":"created","comment":{"url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls/comments/44229972","id":44229972,"diff_hunk":"@@ -43,41 +53,45 @@ class Flick_Model: NSObject {\n                 } catch {\n                     fatalError()\n                 }\n-                if let photosDictionary = parsedResult.valueForKey(\"photos\") as? NSDictionary {\n-                    if let photoArray = photosDictionary.valueForKey(\"photo\") as? [[String:AnyObject]] {\n-                        /// grab a single image\n-                        let randomPhotoIndex = Int(arc4random_uniform(UInt32(photoArray.count)))\n-                        let photoDictionary = photoArray[randomPhotoIndex] as [String:AnyObject]\n-                        /// grab the image url and title\n-                        let photoTitle = photoDictionary[\"title\"] as? String\n-                        let imageUrlString = photoDictionary[\"url_m\"] as? String\n-                        let imageURL = NSURL(string: imageUrlString!)\n-                        /// if an image exists at the url set the image and title\n-                        if let imageData = NSData(contentsOfURL: imageURL!) {\n-                            /// async // submits a block a asynchronous execution on a dispatch queue\n-                            dispatch_async(dispatch_get_main_queue(), { () -> Void in\n-                                /// set the image and the title for the view\n-                                self.photoImageView.image = UIImage(data: imageData)\n-                                self.photoImageView.clipsToBounds = true\n-                                self.photoTitle.text = photoTitle\n-                            })\n-                        } else {\n-                            print(\"Image does not exist\")\n-                        }\n-                    }else {\n-                        print(\"can't find key photo\")\n-                    }\n-                } else {\n+                \n+                guard let photosDictionary = parsedResult.valueForKey(\"photos\") as? NSDictionary else {\n                     print(\"cant find key parsed result\")\n+                    return\n+                }","path":"Flickr/Flick_Model.swift","position":86,"original_position":86,"commit_id":"db19eab725767b7cb5591ef5ff1a04e426d2bc7a","original_commit_id":"db19eab725767b7cb5591ef5ff1a04e426d2bc7a","user":{"login":"y88huang","id":2754710,"avatar_url":"https://avatars.githubusercontent.com/u/2754710?v=3","gravatar_id":"","url":"https://api.github.com/users/y88huang","html_url":"https://github.com/y88huang","followers_url":"https://api.github.com/users/y88huang/followers","following_url":"https://api.github.com/users/y88huang/following{/other_user}","gists_url":"https://api.github.com/users/y88huang/gists{/gist_id}","starred_url":"https://api.github.com/users/y88huang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/y88huang/subscriptions","organizations_url":"https://api.github.com/users/y88huang/orgs","repos_url":"https://api.github.com/users/y88huang/repos","events_url":"https://api.github.com/users/y88huang/events{/privacy}","received_events_url":"https://api.github.com/users/y88huang/received_events","type":"User","site_admin":false},"body":"replace nested if statement with guard statement for readability","created_at":"2015-11-08T20:30:39Z","updated_at":"2015-11-08T20:30:39Z","html_url":"https://github.com/KBryan/FlickrAPIExampleSwift/pull/2#discussion_r44229972","pull_request_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls/comments/44229972"},"html":{"href":"https://github.com/KBryan/FlickrAPIExampleSwift/pull/2#discussion_r44229972"},"pull_request":{"href":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls/2","id":50069064,"html_url":"https://github.com/KBryan/FlickrAPIExampleSwift/pull/2","diff_url":"https://github.com/KBryan/FlickrAPIExampleSwift/pull/2.diff","patch_url":"https://github.com/KBryan/FlickrAPIExampleSwift/pull/2.patch","issue_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/issues/2","number":2,"state":"open","locked":false,"title":"code review","user":{"login":"y88huang","id":2754710,"avatar_url":"https://avatars.githubusercontent.com/u/2754710?v=3","gravatar_id":"","url":"https://api.github.com/users/y88huang","html_url":"https://github.com/y88huang","followers_url":"https://api.github.com/users/y88huang/followers","following_url":"https://api.github.com/users/y88huang/following{/other_user}","gists_url":"https://api.github.com/users/y88huang/gists{/gist_id}","starred_url":"https://api.github.com/users/y88huang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/y88huang/subscriptions","organizations_url":"https://api.github.com/users/y88huang/orgs","repos_url":"https://api.github.com/users/y88huang/repos","events_url":"https://api.github.com/users/y88huang/events{/privacy}","received_events_url":"https://api.github.com/users/y88huang/received_events","type":"User","site_admin":false},"body":"improve readability","created_at":"2015-11-08T20:25:51Z","updated_at":"2015-11-08T20:30:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"353007e52af6a54a4afe01de08d59d9328bbe3cf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls/2/commits","review_comments_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls/2/comments","review_comment_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/issues/2/comments","statuses_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/statuses/db19eab725767b7cb5591ef5ff1a04e426d2bc7a","head":{"label":"y88huang:master","ref":"master","sha":"db19eab725767b7cb5591ef5ff1a04e426d2bc7a","user":{"login":"y88huang","id":2754710,"avatar_url":"https://avatars.githubusercontent.com/u/2754710?v=3","gravatar_id":"","url":"https://api.github.com/users/y88huang","html_url":"https://github.com/y88huang","followers_url":"https://api.github.com/users/y88huang/followers","following_url":"https://api.github.com/users/y88huang/following{/other_user}","gists_url":"https://api.github.com/users/y88huang/gists{/gist_id}","starred_url":"https://api.github.com/users/y88huang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/y88huang/subscriptions","organizations_url":"https://api.github.com/users/y88huang/orgs","repos_url":"https://api.github.com/users/y88huang/repos","events_url":"https://api.github.com/users/y88huang/events{/privacy}","received_events_url":"https://api.github.com/users/y88huang/received_events","type":"User","site_admin":false},"repo":{"id":45793324,"name":"FlickrAPIExampleSwift","full_name":"y88huang/FlickrAPIExampleSwift","owner":{"login":"y88huang","id":2754710,"avatar_url":"https://avatars.githubusercontent.com/u/2754710?v=3","gravatar_id":"","url":"https://api.github.com/users/y88huang","html_url":"https://github.com/y88huang","followers_url":"https://api.github.com/users/y88huang/followers","following_url":"https://api.github.com/users/y88huang/following{/other_user}","gists_url":"https://api.github.com/users/y88huang/gists{/gist_id}","starred_url":"https://api.github.com/users/y88huang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/y88huang/subscriptions","organizations_url":"https://api.github.com/users/y88huang/orgs","repos_url":"https://api.github.com/users/y88huang/repos","events_url":"https://api.github.com/users/y88huang/events{/privacy}","received_events_url":"https://api.github.com/users/y88huang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/y88huang/FlickrAPIExampleSwift","description":"This Application shows how to use the Flickr API in iOS Applications","fork":true,"url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift","forks_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/forks","keys_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/teams","hooks_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/hooks","issue_events_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/issues/events{/number}","events_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/events","assignees_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/assignees{/user}","branches_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/branches{/branch}","tags_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/tags","blobs_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/git/refs{/sha}","trees_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/statuses/{sha}","languages_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/languages","stargazers_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/stargazers","contributors_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/contributors","subscribers_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/subscribers","subscription_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/subscription","commits_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/commits{/sha}","git_commits_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/git/commits{/sha}","comments_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/comments{/number}","issue_comment_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/issues/comments{/number}","contents_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/contents/{+path}","compare_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/merges","archive_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/downloads","issues_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/issues{/number}","pulls_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/pulls{/number}","milestones_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/milestones{/number}","notifications_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/labels{/name}","releases_url":"https://api.github.com/repos/y88huang/FlickrAPIExampleSwift/releases{/id}","created_at":"2015-11-08T18:36:27Z","updated_at":"2015-11-08T18:36:28Z","pushed_at":"2015-11-08T20:24:54Z","git_url":"git://github.com/y88huang/FlickrAPIExampleSwift.git","ssh_url":"git@github.com:y88huang/FlickrAPIExampleSwift.git","clone_url":"https://github.com/y88huang/FlickrAPIExampleSwift.git","svn_url":"https://github.com/y88huang/FlickrAPIExampleSwift","homepage":null,"size":160,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"KBryan:master","ref":"master","sha":"a95627efa5d7456ce7861bc122eb88cc53ec1c3d","user":{"login":"KBryan","id":681817,"avatar_url":"https://avatars.githubusercontent.com/u/681817?v=3","gravatar_id":"","url":"https://api.github.com/users/KBryan","html_url":"https://github.com/KBryan","followers_url":"https://api.github.com/users/KBryan/followers","following_url":"https://api.github.com/users/KBryan/following{/other_user}","gists_url":"https://api.github.com/users/KBryan/gists{/gist_id}","starred_url":"https://api.github.com/users/KBryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KBryan/subscriptions","organizations_url":"https://api.github.com/users/KBryan/orgs","repos_url":"https://api.github.com/users/KBryan/repos","events_url":"https://api.github.com/users/KBryan/events{/privacy}","received_events_url":"https://api.github.com/users/KBryan/received_events","type":"User","site_admin":false},"repo":{"id":33414606,"name":"FlickrAPIExampleSwift","full_name":"KBryan/FlickrAPIExampleSwift","owner":{"login":"KBryan","id":681817,"avatar_url":"https://avatars.githubusercontent.com/u/681817?v=3","gravatar_id":"","url":"https://api.github.com/users/KBryan","html_url":"https://github.com/KBryan","followers_url":"https://api.github.com/users/KBryan/followers","following_url":"https://api.github.com/users/KBryan/following{/other_user}","gists_url":"https://api.github.com/users/KBryan/gists{/gist_id}","starred_url":"https://api.github.com/users/KBryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KBryan/subscriptions","organizations_url":"https://api.github.com/users/KBryan/orgs","repos_url":"https://api.github.com/users/KBryan/repos","events_url":"https://api.github.com/users/KBryan/events{/privacy}","received_events_url":"https://api.github.com/users/KBryan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/KBryan/FlickrAPIExampleSwift","description":"This Application shows how to use the Flickr API in iOS Applications","fork":false,"url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift","forks_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/forks","keys_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/teams","hooks_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/hooks","issue_events_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/issues/events{/number}","events_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/events","assignees_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/assignees{/user}","branches_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/branches{/branch}","tags_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/tags","blobs_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/git/refs{/sha}","trees_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/statuses/{sha}","languages_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/languages","stargazers_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/stargazers","contributors_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/contributors","subscribers_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/subscribers","subscription_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/subscription","commits_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/commits{/sha}","git_commits_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/git/commits{/sha}","comments_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/comments{/number}","issue_comment_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/issues/comments{/number}","contents_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/contents/{+path}","compare_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/merges","archive_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/downloads","issues_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/issues{/number}","pulls_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls{/number}","milestones_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/milestones{/number}","notifications_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/labels{/name}","releases_url":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/releases{/id}","created_at":"2015-04-04T17:53:29Z","updated_at":"2015-04-15T10:27:06Z","pushed_at":"2015-11-08T20:25:52Z","git_url":"git://github.com/KBryan/FlickrAPIExampleSwift.git","ssh_url":"git@github.com:KBryan/FlickrAPIExampleSwift.git","clone_url":"https://github.com/KBryan/FlickrAPIExampleSwift.git","svn_url":"https://github.com/KBryan/FlickrAPIExampleSwift","homepage":null,"size":160,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls/2"},"html":{"href":"https://github.com/KBryan/FlickrAPIExampleSwift/pull/2"},"issue":{"href":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/issues/2"},"comments":{"href":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/KBryan/FlickrAPIExampleSwift/statuses/db19eab725767b7cb5591ef5ff1a04e426d2bc7a"}}}}