{"action":"created","comment":{"url":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls/comments/37956781","id":37956781,"diff_hunk":"@@ -0,0 +1,32 @@\n+import UIKit\n+\n+public class ImageStack {\n+\n+  public struct Notifications {\n+    public static let imageDidPushNotification = \"imageDidPush:\"\n+    public static let imageDidDropNotification = \"imageDidDrop:\"\n+    public static let stackDidReload = \"stackDidReload:\"\n+    public static let imageKey = \"image\"\n+  }\n+\n+  public var images: [UIImage] = [UIImage]()\n+\n+  public func pushImage(image: UIImage) {\n+    images.append(image)\n+    NSNotificationCenter.defaultCenter().postNotificationName(Notifications.imageDidPushNotification, object: self, userInfo: [\"image\" : image])\n+  }\n+\n+  public func dropImage(image: UIImage) {\n+    images = images.filter() {$0 != image}\n+    NSNotificationCenter.defaultCenter().postNotificationName(Notifications.imageDidDropNotification, object: self, userInfo: [\"image\" : image])\n+  }\n+\n+  public func resetImages(newImages: [UIImage]) {\n+    images = newImages\n+    NSNotificationCenter.defaultCenter().postNotificationName(Notifications.stackDidReload, object: self, userInfo: nil)\n+  }\n+\n+  public func containsImage(image: UIImage) -> Bool {\n+    return contains(images, image)\n+  }\n+}","path":"Source/BottomView/ImageStack.swift","position":32,"original_position":32,"commit_id":"72955c7863e62ed825186d83ac60e1a6dbd541e0","original_commit_id":"72955c7863e62ed825186d83ac60e1a6dbd541e0","user":{"login":"RamonGilabert","id":6138120,"avatar_url":"https://avatars.githubusercontent.com/u/6138120?v=3","gravatar_id":"","url":"https://api.github.com/users/RamonGilabert","html_url":"https://github.com/RamonGilabert","followers_url":"https://api.github.com/users/RamonGilabert/followers","following_url":"https://api.github.com/users/RamonGilabert/following{/other_user}","gists_url":"https://api.github.com/users/RamonGilabert/gists{/gist_id}","starred_url":"https://api.github.com/users/RamonGilabert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RamonGilabert/subscriptions","organizations_url":"https://api.github.com/users/RamonGilabert/orgs","repos_url":"https://api.github.com/users/RamonGilabert/repos","events_url":"https://api.github.com/users/RamonGilabert/events{/privacy}","received_events_url":"https://api.github.com/users/RamonGilabert/received_events","type":"User","site_admin":false},"body":"You should add a new line here.","created_at":"2015-08-26T08:22:19Z","updated_at":"2015-08-26T08:22:19Z","html_url":"https://github.com/hyperoslo/ImagePicker/pull/13#discussion_r37956781","pull_request_url":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls/comments/37956781"},"html":{"href":"https://github.com/hyperoslo/ImagePicker/pull/13#discussion_r37956781"},"pull_request":{"href":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls/13","id":42469227,"html_url":"https://github.com/hyperoslo/ImagePicker/pull/13","diff_url":"https://github.com/hyperoslo/ImagePicker/pull/13.diff","patch_url":"https://github.com/hyperoslo/ImagePicker/pull/13.patch","issue_url":"https://api.github.com/repos/hyperoslo/ImagePicker/issues/13","number":13,"state":"open","locked":false,"title":"Refactor","user":{"login":"richardoti","id":8013017,"avatar_url":"https://avatars.githubusercontent.com/u/8013017?v=3","gravatar_id":"","url":"https://api.github.com/users/richardoti","html_url":"https://github.com/richardoti","followers_url":"https://api.github.com/users/richardoti/followers","following_url":"https://api.github.com/users/richardoti/following{/other_user}","gists_url":"https://api.github.com/users/richardoti/gists{/gist_id}","starred_url":"https://api.github.com/users/richardoti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardoti/subscriptions","organizations_url":"https://api.github.com/users/richardoti/orgs","repos_url":"https://api.github.com/users/richardoti/repos","events_url":"https://api.github.com/users/richardoti/events{/privacy}","received_events_url":"https://api.github.com/users/richardoti/received_events","type":"User","site_admin":false},"body":"I've separated view (StackView) from model (ImageStack), so we could easily swap views if needed.\r\nNow ImageStack is the model object which represents selected photos. As it's state is being shown by multiple items (StackView, selected photos number) - I use notifications to change their state.\r\n\r\nI've removed some delegate calls as they are not needed now, as the controller owns the stack and passes it to the collection view.\r\n\r\nIt is possible to reuse separate components. StackView and ImageStack were designed to be reusable - i.e. it is possible to swap view with any other, or add more/less images.\r\n\r\nTested on device.\r\n\r\n@RamonGilabert how do you feel about it? I think, now it is finalized","created_at":"2015-08-14T15:44:48Z","updated_at":"2015-08-26T08:22:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"812bd3c6636c6f380d338a6fd7fa667694bee6da","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls/13/commits","review_comments_url":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls/13/comments","review_comment_url":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hyperoslo/ImagePicker/issues/13/comments","statuses_url":"https://api.github.com/repos/hyperoslo/ImagePicker/statuses/72955c7863e62ed825186d83ac60e1a6dbd541e0","head":{"label":"hyperoslo:refactor","ref":"refactor","sha":"72955c7863e62ed825186d83ac60e1a6dbd541e0","user":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"repo":{"id":40171919,"name":"ImagePicker","full_name":"hyperoslo/ImagePicker","owner":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyperoslo/ImagePicker","description":"Reinventing the way ImagePicker work","fork":false,"url":"https://api.github.com/repos/hyperoslo/ImagePicker","forks_url":"https://api.github.com/repos/hyperoslo/ImagePicker/forks","keys_url":"https://api.github.com/repos/hyperoslo/ImagePicker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperoslo/ImagePicker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperoslo/ImagePicker/teams","hooks_url":"https://api.github.com/repos/hyperoslo/ImagePicker/hooks","issue_events_url":"https://api.github.com/repos/hyperoslo/ImagePicker/issues/events{/number}","events_url":"https://api.github.com/repos/hyperoslo/ImagePicker/events","assignees_url":"https://api.github.com/repos/hyperoslo/ImagePicker/assignees{/user}","branches_url":"https://api.github.com/repos/hyperoslo/ImagePicker/branches{/branch}","tags_url":"https://api.github.com/repos/hyperoslo/ImagePicker/tags","blobs_url":"https://api.github.com/repos/hyperoslo/ImagePicker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperoslo/ImagePicker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperoslo/ImagePicker/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperoslo/ImagePicker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperoslo/ImagePicker/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperoslo/ImagePicker/languages","stargazers_url":"https://api.github.com/repos/hyperoslo/ImagePicker/stargazers","contributors_url":"https://api.github.com/repos/hyperoslo/ImagePicker/contributors","subscribers_url":"https://api.github.com/repos/hyperoslo/ImagePicker/subscribers","subscription_url":"https://api.github.com/repos/hyperoslo/ImagePicker/subscription","commits_url":"https://api.github.com/repos/hyperoslo/ImagePicker/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperoslo/ImagePicker/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperoslo/ImagePicker/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperoslo/ImagePicker/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyperoslo/ImagePicker/contents/{+path}","compare_url":"https://api.github.com/repos/hyperoslo/ImagePicker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperoslo/ImagePicker/merges","archive_url":"https://api.github.com/repos/hyperoslo/ImagePicker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperoslo/ImagePicker/downloads","issues_url":"https://api.github.com/repos/hyperoslo/ImagePicker/issues{/number}","pulls_url":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperoslo/ImagePicker/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperoslo/ImagePicker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperoslo/ImagePicker/labels{/name}","releases_url":"https://api.github.com/repos/hyperoslo/ImagePicker/releases{/id}","created_at":"2015-08-04T08:13:33Z","updated_at":"2015-08-07T10:53:08Z","pushed_at":"2015-08-26T07:48:16Z","git_url":"git://github.com/hyperoslo/ImagePicker.git","ssh_url":"git@github.com:hyperoslo/ImagePicker.git","clone_url":"https://github.com/hyperoslo/ImagePicker.git","svn_url":"https://github.com/hyperoslo/ImagePicker","homepage":null,"size":518,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"hyperoslo:master","ref":"master","sha":"c6c389aed67eded922d52da49c9bce3a1781a87a","user":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"repo":{"id":40171919,"name":"ImagePicker","full_name":"hyperoslo/ImagePicker","owner":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyperoslo/ImagePicker","description":"Reinventing the way ImagePicker work","fork":false,"url":"https://api.github.com/repos/hyperoslo/ImagePicker","forks_url":"https://api.github.com/repos/hyperoslo/ImagePicker/forks","keys_url":"https://api.github.com/repos/hyperoslo/ImagePicker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperoslo/ImagePicker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperoslo/ImagePicker/teams","hooks_url":"https://api.github.com/repos/hyperoslo/ImagePicker/hooks","issue_events_url":"https://api.github.com/repos/hyperoslo/ImagePicker/issues/events{/number}","events_url":"https://api.github.com/repos/hyperoslo/ImagePicker/events","assignees_url":"https://api.github.com/repos/hyperoslo/ImagePicker/assignees{/user}","branches_url":"https://api.github.com/repos/hyperoslo/ImagePicker/branches{/branch}","tags_url":"https://api.github.com/repos/hyperoslo/ImagePicker/tags","blobs_url":"https://api.github.com/repos/hyperoslo/ImagePicker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperoslo/ImagePicker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperoslo/ImagePicker/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperoslo/ImagePicker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperoslo/ImagePicker/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperoslo/ImagePicker/languages","stargazers_url":"https://api.github.com/repos/hyperoslo/ImagePicker/stargazers","contributors_url":"https://api.github.com/repos/hyperoslo/ImagePicker/contributors","subscribers_url":"https://api.github.com/repos/hyperoslo/ImagePicker/subscribers","subscription_url":"https://api.github.com/repos/hyperoslo/ImagePicker/subscription","commits_url":"https://api.github.com/repos/hyperoslo/ImagePicker/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperoslo/ImagePicker/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperoslo/ImagePicker/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperoslo/ImagePicker/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyperoslo/ImagePicker/contents/{+path}","compare_url":"https://api.github.com/repos/hyperoslo/ImagePicker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperoslo/ImagePicker/merges","archive_url":"https://api.github.com/repos/hyperoslo/ImagePicker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperoslo/ImagePicker/downloads","issues_url":"https://api.github.com/repos/hyperoslo/ImagePicker/issues{/number}","pulls_url":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperoslo/ImagePicker/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperoslo/ImagePicker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperoslo/ImagePicker/labels{/name}","releases_url":"https://api.github.com/repos/hyperoslo/ImagePicker/releases{/id}","created_at":"2015-08-04T08:13:33Z","updated_at":"2015-08-07T10:53:08Z","pushed_at":"2015-08-26T07:48:16Z","git_url":"git://github.com/hyperoslo/ImagePicker.git","ssh_url":"git@github.com:hyperoslo/ImagePicker.git","clone_url":"https://github.com/hyperoslo/ImagePicker.git","svn_url":"https://github.com/hyperoslo/ImagePicker","homepage":null,"size":518,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls/13"},"html":{"href":"https://github.com/hyperoslo/ImagePicker/pull/13"},"issue":{"href":"https://api.github.com/repos/hyperoslo/ImagePicker/issues/13"},"comments":{"href":"https://api.github.com/repos/hyperoslo/ImagePicker/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hyperoslo/ImagePicker/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/hyperoslo/ImagePicker/statuses/72955c7863e62ed825186d83ac60e1a6dbd541e0"}}}}