{"action":"created","comment":{"url":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls/comments/42464930","id":42464930,"diff_hunk":"@@ -0,0 +1,66 @@\n+//\n+//  ChoosePhotoViewController.swift\n+//  InstagramApp\n+//\n+//  Created by Seo Kyohei on 2015/10/15.\n+//  Copyright © 2015年 Kyohei Seo. All rights reserved.\n+//\n+\n+import UIKit\n+import Photos\n+\n+class ChoosePhotoViewController: UIViewController {\n+    var photoAssets = [PHAsset]()\n+\n+    override func viewDidLoad() {\n+        super.viewDidLoad()\n+        self.checkAuthorizationStatus()\n+        self.view.backgroundColor = UIColor.lightGrayColor()\n+    }\n+\n+    override func didReceiveMemoryWarning() {\n+        super.didReceiveMemoryWarning()\n+        // Dispose of any resources that can be recreated.\n+    }\n+    \n+    \n+    //フォトライブラリへのアクセス許可を求める\n+    private func checkAuthorizationStatus() {\n+        let status = PHPhotoLibrary.authorizationStatus()\n+        \n+        switch status {\n+        case .Authorized:\n+            self.getAllPhotosInfo()\n+        default:\n+            PHPhotoLibrary.requestAuthorization({ (status) -> Void in\n+                if status == .Authorized {\n+                    self.getAllPhotosInfo()\n+                }\n+            })\n+        }\n+    }\n+    \n+    //フォトライブラリから全ての写真のPHAssetオブジェクトを取得する\n+    private func getAllPhotosInfo() {\n+        photoAssets = []\n+        \n+        //ソート条件を指定\n+        let options = PHFetchOptions()\n+        options.sortDescriptors = [NSSortDescriptor(key: \"creationDate\", ascending: false)]\n+        let assets: PHFetchResult = PHAsset.fetchAssetsWithMediaType(.Image, options: options)\n+        assets.enumerateObjectsUsingBlock { (asset, index, stop) -> Void in\n+            \n+            self.photoAssets.append(asset as! PHAsset)\n+            \n+            let frame = CGRect(x: 0, y: self.view.frame.height / 2, width: self.view.frame.width, height: self.view.frame.height / 2)","path":"InstagramApp/ChoosePhotoViewController.swift","position":55,"original_position":55,"commit_id":"9e4dceebedaeea2a7b725171a8b107f5443d26bd","original_commit_id":"9e4dceebedaeea2a7b725171a8b107f5443d26bd","user":{"login":"keitin","id":9265641,"avatar_url":"https://avatars.githubusercontent.com/u/9265641?v=3","gravatar_id":"","url":"https://api.github.com/users/keitin","html_url":"https://github.com/keitin","followers_url":"https://api.github.com/users/keitin/followers","following_url":"https://api.github.com/users/keitin/following{/other_user}","gists_url":"https://api.github.com/users/keitin/gists{/gist_id}","starred_url":"https://api.github.com/users/keitin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keitin/subscriptions","organizations_url":"https://api.github.com/users/keitin/orgs","repos_url":"https://api.github.com/users/keitin/repos","events_url":"https://api.github.com/users/keitin/events{/privacy}","received_events_url":"https://api.github.com/users/keitin/received_events","type":"User","site_admin":false},"body":"selfは省略しましょう","created_at":"2015-10-20T07:50:36Z","updated_at":"2015-10-20T07:50:36Z","html_url":"https://github.com/kyohei0423/InstagramApp/pull/1#discussion_r42464930","pull_request_url":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls/comments/42464930"},"html":{"href":"https://github.com/kyohei0423/InstagramApp/pull/1#discussion_r42464930"},"pull_request":{"href":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls/1","id":48010592,"html_url":"https://github.com/kyohei0423/InstagramApp/pull/1","diff_url":"https://github.com/kyohei0423/InstagramApp/pull/1.diff","patch_url":"https://github.com/kyohei0423/InstagramApp/pull/1.patch","issue_url":"https://api.github.com/repos/kyohei0423/InstagramApp/issues/1","number":1,"state":"open","locked":false,"title":"Make post view controller","user":{"login":"kyohei0423","id":7753180,"avatar_url":"https://avatars.githubusercontent.com/u/7753180?v=3","gravatar_id":"","url":"https://api.github.com/users/kyohei0423","html_url":"https://github.com/kyohei0423","followers_url":"https://api.github.com/users/kyohei0423/followers","following_url":"https://api.github.com/users/kyohei0423/following{/other_user}","gists_url":"https://api.github.com/users/kyohei0423/gists{/gist_id}","starred_url":"https://api.github.com/users/kyohei0423/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyohei0423/subscriptions","organizations_url":"https://api.github.com/users/kyohei0423/orgs","repos_url":"https://api.github.com/users/kyohei0423/repos","events_url":"https://api.github.com/users/kyohei0423/events{/privacy}","received_events_url":"https://api.github.com/users/kyohei0423/received_events","type":"User","site_admin":false},"body":"# WHAT\r\nカメラロールの画像をCollectionViewに表示するようにした","created_at":"2015-10-18T15:25:40Z","updated_at":"2015-10-20T07:50:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d4148fdbc1d7050dc81eee19e4ac89929d372cb0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls/1/commits","review_comments_url":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls/1/comments","review_comment_url":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kyohei0423/InstagramApp/issues/1/comments","statuses_url":"https://api.github.com/repos/kyohei0423/InstagramApp/statuses/9e4dceebedaeea2a7b725171a8b107f5443d26bd","head":{"label":"kyohei0423:make_postViewController","ref":"make_postViewController","sha":"9e4dceebedaeea2a7b725171a8b107f5443d26bd","user":{"login":"kyohei0423","id":7753180,"avatar_url":"https://avatars.githubusercontent.com/u/7753180?v=3","gravatar_id":"","url":"https://api.github.com/users/kyohei0423","html_url":"https://github.com/kyohei0423","followers_url":"https://api.github.com/users/kyohei0423/followers","following_url":"https://api.github.com/users/kyohei0423/following{/other_user}","gists_url":"https://api.github.com/users/kyohei0423/gists{/gist_id}","starred_url":"https://api.github.com/users/kyohei0423/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyohei0423/subscriptions","organizations_url":"https://api.github.com/users/kyohei0423/orgs","repos_url":"https://api.github.com/users/kyohei0423/repos","events_url":"https://api.github.com/users/kyohei0423/events{/privacy}","received_events_url":"https://api.github.com/users/kyohei0423/received_events","type":"User","site_admin":false},"repo":{"id":44169888,"name":"InstagramApp","full_name":"kyohei0423/InstagramApp","owner":{"login":"kyohei0423","id":7753180,"avatar_url":"https://avatars.githubusercontent.com/u/7753180?v=3","gravatar_id":"","url":"https://api.github.com/users/kyohei0423","html_url":"https://github.com/kyohei0423","followers_url":"https://api.github.com/users/kyohei0423/followers","following_url":"https://api.github.com/users/kyohei0423/following{/other_user}","gists_url":"https://api.github.com/users/kyohei0423/gists{/gist_id}","starred_url":"https://api.github.com/users/kyohei0423/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyohei0423/subscriptions","organizations_url":"https://api.github.com/users/kyohei0423/orgs","repos_url":"https://api.github.com/users/kyohei0423/repos","events_url":"https://api.github.com/users/kyohei0423/events{/privacy}","received_events_url":"https://api.github.com/users/kyohei0423/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kyohei0423/InstagramApp","description":"","fork":false,"url":"https://api.github.com/repos/kyohei0423/InstagramApp","forks_url":"https://api.github.com/repos/kyohei0423/InstagramApp/forks","keys_url":"https://api.github.com/repos/kyohei0423/InstagramApp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kyohei0423/InstagramApp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kyohei0423/InstagramApp/teams","hooks_url":"https://api.github.com/repos/kyohei0423/InstagramApp/hooks","issue_events_url":"https://api.github.com/repos/kyohei0423/InstagramApp/issues/events{/number}","events_url":"https://api.github.com/repos/kyohei0423/InstagramApp/events","assignees_url":"https://api.github.com/repos/kyohei0423/InstagramApp/assignees{/user}","branches_url":"https://api.github.com/repos/kyohei0423/InstagramApp/branches{/branch}","tags_url":"https://api.github.com/repos/kyohei0423/InstagramApp/tags","blobs_url":"https://api.github.com/repos/kyohei0423/InstagramApp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kyohei0423/InstagramApp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kyohei0423/InstagramApp/git/refs{/sha}","trees_url":"https://api.github.com/repos/kyohei0423/InstagramApp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kyohei0423/InstagramApp/statuses/{sha}","languages_url":"https://api.github.com/repos/kyohei0423/InstagramApp/languages","stargazers_url":"https://api.github.com/repos/kyohei0423/InstagramApp/stargazers","contributors_url":"https://api.github.com/repos/kyohei0423/InstagramApp/contributors","subscribers_url":"https://api.github.com/repos/kyohei0423/InstagramApp/subscribers","subscription_url":"https://api.github.com/repos/kyohei0423/InstagramApp/subscription","commits_url":"https://api.github.com/repos/kyohei0423/InstagramApp/commits{/sha}","git_commits_url":"https://api.github.com/repos/kyohei0423/InstagramApp/git/commits{/sha}","comments_url":"https://api.github.com/repos/kyohei0423/InstagramApp/comments{/number}","issue_comment_url":"https://api.github.com/repos/kyohei0423/InstagramApp/issues/comments{/number}","contents_url":"https://api.github.com/repos/kyohei0423/InstagramApp/contents/{+path}","compare_url":"https://api.github.com/repos/kyohei0423/InstagramApp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kyohei0423/InstagramApp/merges","archive_url":"https://api.github.com/repos/kyohei0423/InstagramApp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kyohei0423/InstagramApp/downloads","issues_url":"https://api.github.com/repos/kyohei0423/InstagramApp/issues{/number}","pulls_url":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls{/number}","milestones_url":"https://api.github.com/repos/kyohei0423/InstagramApp/milestones{/number}","notifications_url":"https://api.github.com/repos/kyohei0423/InstagramApp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kyohei0423/InstagramApp/labels{/name}","releases_url":"https://api.github.com/repos/kyohei0423/InstagramApp/releases{/id}","created_at":"2015-10-13T10:50:29Z","updated_at":"2015-10-13T10:53:23Z","pushed_at":"2015-10-18T15:25:41Z","git_url":"git://github.com/kyohei0423/InstagramApp.git","ssh_url":"git@github.com:kyohei0423/InstagramApp.git","clone_url":"https://github.com/kyohei0423/InstagramApp.git","svn_url":"https://github.com/kyohei0423/InstagramApp","homepage":"","size":0,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"kyohei0423:master","ref":"master","sha":"a9acc0587c02e4abcb7f52a0ee5c15ef83530982","user":{"login":"kyohei0423","id":7753180,"avatar_url":"https://avatars.githubusercontent.com/u/7753180?v=3","gravatar_id":"","url":"https://api.github.com/users/kyohei0423","html_url":"https://github.com/kyohei0423","followers_url":"https://api.github.com/users/kyohei0423/followers","following_url":"https://api.github.com/users/kyohei0423/following{/other_user}","gists_url":"https://api.github.com/users/kyohei0423/gists{/gist_id}","starred_url":"https://api.github.com/users/kyohei0423/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyohei0423/subscriptions","organizations_url":"https://api.github.com/users/kyohei0423/orgs","repos_url":"https://api.github.com/users/kyohei0423/repos","events_url":"https://api.github.com/users/kyohei0423/events{/privacy}","received_events_url":"https://api.github.com/users/kyohei0423/received_events","type":"User","site_admin":false},"repo":{"id":44169888,"name":"InstagramApp","full_name":"kyohei0423/InstagramApp","owner":{"login":"kyohei0423","id":7753180,"avatar_url":"https://avatars.githubusercontent.com/u/7753180?v=3","gravatar_id":"","url":"https://api.github.com/users/kyohei0423","html_url":"https://github.com/kyohei0423","followers_url":"https://api.github.com/users/kyohei0423/followers","following_url":"https://api.github.com/users/kyohei0423/following{/other_user}","gists_url":"https://api.github.com/users/kyohei0423/gists{/gist_id}","starred_url":"https://api.github.com/users/kyohei0423/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyohei0423/subscriptions","organizations_url":"https://api.github.com/users/kyohei0423/orgs","repos_url":"https://api.github.com/users/kyohei0423/repos","events_url":"https://api.github.com/users/kyohei0423/events{/privacy}","received_events_url":"https://api.github.com/users/kyohei0423/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kyohei0423/InstagramApp","description":"","fork":false,"url":"https://api.github.com/repos/kyohei0423/InstagramApp","forks_url":"https://api.github.com/repos/kyohei0423/InstagramApp/forks","keys_url":"https://api.github.com/repos/kyohei0423/InstagramApp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kyohei0423/InstagramApp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kyohei0423/InstagramApp/teams","hooks_url":"https://api.github.com/repos/kyohei0423/InstagramApp/hooks","issue_events_url":"https://api.github.com/repos/kyohei0423/InstagramApp/issues/events{/number}","events_url":"https://api.github.com/repos/kyohei0423/InstagramApp/events","assignees_url":"https://api.github.com/repos/kyohei0423/InstagramApp/assignees{/user}","branches_url":"https://api.github.com/repos/kyohei0423/InstagramApp/branches{/branch}","tags_url":"https://api.github.com/repos/kyohei0423/InstagramApp/tags","blobs_url":"https://api.github.com/repos/kyohei0423/InstagramApp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kyohei0423/InstagramApp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kyohei0423/InstagramApp/git/refs{/sha}","trees_url":"https://api.github.com/repos/kyohei0423/InstagramApp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kyohei0423/InstagramApp/statuses/{sha}","languages_url":"https://api.github.com/repos/kyohei0423/InstagramApp/languages","stargazers_url":"https://api.github.com/repos/kyohei0423/InstagramApp/stargazers","contributors_url":"https://api.github.com/repos/kyohei0423/InstagramApp/contributors","subscribers_url":"https://api.github.com/repos/kyohei0423/InstagramApp/subscribers","subscription_url":"https://api.github.com/repos/kyohei0423/InstagramApp/subscription","commits_url":"https://api.github.com/repos/kyohei0423/InstagramApp/commits{/sha}","git_commits_url":"https://api.github.com/repos/kyohei0423/InstagramApp/git/commits{/sha}","comments_url":"https://api.github.com/repos/kyohei0423/InstagramApp/comments{/number}","issue_comment_url":"https://api.github.com/repos/kyohei0423/InstagramApp/issues/comments{/number}","contents_url":"https://api.github.com/repos/kyohei0423/InstagramApp/contents/{+path}","compare_url":"https://api.github.com/repos/kyohei0423/InstagramApp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kyohei0423/InstagramApp/merges","archive_url":"https://api.github.com/repos/kyohei0423/InstagramApp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kyohei0423/InstagramApp/downloads","issues_url":"https://api.github.com/repos/kyohei0423/InstagramApp/issues{/number}","pulls_url":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls{/number}","milestones_url":"https://api.github.com/repos/kyohei0423/InstagramApp/milestones{/number}","notifications_url":"https://api.github.com/repos/kyohei0423/InstagramApp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kyohei0423/InstagramApp/labels{/name}","releases_url":"https://api.github.com/repos/kyohei0423/InstagramApp/releases{/id}","created_at":"2015-10-13T10:50:29Z","updated_at":"2015-10-13T10:53:23Z","pushed_at":"2015-10-18T15:25:41Z","git_url":"git://github.com/kyohei0423/InstagramApp.git","ssh_url":"git@github.com:kyohei0423/InstagramApp.git","clone_url":"https://github.com/kyohei0423/InstagramApp.git","svn_url":"https://github.com/kyohei0423/InstagramApp","homepage":"","size":0,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls/1"},"html":{"href":"https://github.com/kyohei0423/InstagramApp/pull/1"},"issue":{"href":"https://api.github.com/repos/kyohei0423/InstagramApp/issues/1"},"comments":{"href":"https://api.github.com/repos/kyohei0423/InstagramApp/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kyohei0423/InstagramApp/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/kyohei0423/InstagramApp/statuses/9e4dceebedaeea2a7b725171a8b107f5443d26bd"}}}}