{"action":"created","comment":{"url":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls/comments/65660535","id":65660535,"diff_hunk":"@@ -85,47 +85,52 @@ public class WidgetTemplateView: UIView {\n \n     @IBOutlet private weak var contentViewContainer: UIView!\n \n-    @IBOutlet private weak var containerTopConstraint: NSLayoutConstraint!\n-    @IBOutlet private weak var containerTopToHeaderBottomConstraint: NSLayoutConstraint!\n+    @IBOutlet private var containerTopConstraint: NSLayoutConstraint!\n+    @IBOutlet private var containerTopToHeaderBottomConstraint: NSLayoutConstraint!\n \n     private var contentView: UIView?\n+    private(set) var currentLayoutSettings: WidgetTemplateLayoutSettings?\n+    static let defaultLayoutSettings = WidgetTemplateLayoutSettings(contentMargin: UIEdgeInsetsZero, displayContentUnderHeader: false)\n \n     public class func viewWithViewModel(viewModel: WidgetTemplateViewModelType, layoutSettings: WidgetTemplateLayoutSettings) -> WidgetTemplateView {\n         let view = WidgetTemplateView.fromNib()\n-        view.configureWithViewModel(viewModel)\n-        view.configureLayoutSettings(layoutSettings)\n+        view.configureWithViewModel(viewModel, layoutSettings: layoutSettings)\n         return view\n     }\n     \n     public class func viewWithErrorViewModel(viewModel: WidgetErrorTemplateViewModel) -> WidgetTemplateView {\n-        let defaultErrorLayout = WidgetTemplateLayoutSettings(contentMargin: UIEdgeInsetsZero, displayContentUnderHeader: false)\n-        return viewWithViewModel(viewModel, layoutSettings: defaultErrorLayout)\n+        return viewWithViewModel(viewModel, layoutSettings: defaultLayoutSettings)\n     }\n \n-    private func configureWithViewModel(viewModel: WidgetTemplateViewModelType) {\n+    public func configureWithViewModel(viewModel: WidgetTemplateViewModelType, layoutSettings: WidgetTemplateLayoutSettings? = nil) {\n+        let layoutSettings = (layoutSettings ?? currentLayoutSettings) ?? self.dynamicType.defaultLayoutSettings\n+        \n         contentView = viewModel.contentView\n-        configureContenView(viewModel.contentView)\n+        configureContentView(viewModel.contentView)\n         configureTitle(viewModel.title)\n         configureSubtitle(viewModel.subtitle)\n+        configureLayoutSettings(layoutSettings)\n     }\n \n-    private func configureLayoutSettings(layoutSettings: WidgetTemplateLayoutSettings) {\n+    public func configureLayoutSettings(layoutSettings: WidgetTemplateLayoutSettings) {\n         if layoutSettings.displayContentUnderHeader {\n             containerTopToHeaderBottomConstraint.active = false\n             containerTopConstraint.active = true\n         } else {\n             containerTopToHeaderBottomConstraint.active = true\n             containerTopConstraint.active = false\n         }\n+        currentLayoutSettings = layoutSettings\n \n         guard let contentView = contentView else { return }\n-        contentView.frame = UIEdgeInsetsInsetRect(contentView.bounds, layoutSettings.contentMargin)\n+        contentView.frame = UIEdgeInsetsInsetRect(contentViewContainer.bounds, layoutSettings.contentMargin)\n+        contentView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]\n+        setNeedsLayout()","path":"GCBCore/Views/WidgetTemplateView.swift","position":54,"original_position":54,"commit_id":"15c7a4f7695512c62f60049f08f4e94ef29e3762","original_commit_id":"15c7a4f7695512c62f60049f08f4e94ef29e3762","user":{"login":"krris","id":1786612,"avatar_url":"https://avatars.githubusercontent.com/u/1786612?v=3","gravatar_id":"","url":"https://api.github.com/users/krris","html_url":"https://github.com/krris","followers_url":"https://api.github.com/users/krris/followers","following_url":"https://api.github.com/users/krris/following{/other_user}","gists_url":"https://api.github.com/users/krris/gists{/gist_id}","starred_url":"https://api.github.com/users/krris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krris/subscriptions","organizations_url":"https://api.github.com/users/krris/orgs","repos_url":"https://api.github.com/users/krris/repos","events_url":"https://api.github.com/users/krris/events{/privacy}","received_events_url":"https://api.github.com/users/krris/received_events","type":"User","site_admin":false},"body":"Do we need this? As I understand changing `frame` should also trigger layout update during next update cycle. Correct me if I'm wrong. ","created_at":"2016-06-03T06:12:31Z","updated_at":"2016-06-03T06:12:31Z","html_url":"https://github.com/macoscope/GrandCentralBoard/pull/170#discussion_r65660535","pull_request_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls/170","_links":{"self":{"href":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls/comments/65660535"},"html":{"href":"https://github.com/macoscope/GrandCentralBoard/pull/170#discussion_r65660535"},"pull_request":{"href":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls/170"}}},"pull_request":{"url":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls/170","id":72322995,"html_url":"https://github.com/macoscope/GrandCentralBoard/pull/170","diff_url":"https://github.com/macoscope/GrandCentralBoard/pull/170.diff","patch_url":"https://github.com/macoscope/GrandCentralBoard/pull/170.patch","issue_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/issues/170","number":170,"state":"open","locked":false,"title":"Feature/make widget template view reusable","user":{"login":"michallaskowski","id":3706309,"avatar_url":"https://avatars.githubusercontent.com/u/3706309?v=3","gravatar_id":"","url":"https://api.github.com/users/michallaskowski","html_url":"https://github.com/michallaskowski","followers_url":"https://api.github.com/users/michallaskowski/followers","following_url":"https://api.github.com/users/michallaskowski/following{/other_user}","gists_url":"https://api.github.com/users/michallaskowski/gists{/gist_id}","starred_url":"https://api.github.com/users/michallaskowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michallaskowski/subscriptions","organizations_url":"https://api.github.com/users/michallaskowski/orgs","repos_url":"https://api.github.com/users/michallaskowski/repos","events_url":"https://api.github.com/users/michallaskowski/events{/privacy}","received_events_url":"https://api.github.com/users/michallaskowski/received_events","type":"User","site_admin":false},"body":"This PR will make WidgetTemplateView reusable, that means it can be configured with a view model or layout settings multiple times.\r\n\r\n- [x] [SwiftLint](https://github.com/Realm/SwiftLint) is installed on your system\r\n- [x] The project does not generate any warnings or errors\r\n- [x] The tests are passing\r\n- [x] Branch name is in line with [GitFlow](http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/)\r\n","created_at":"2016-06-02T10:29:14Z","updated_at":"2016-06-03T06:12:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"94039d71b16d08bf08ef97218a2dec864a7855d0","assignee":{"login":"krris","id":1786612,"avatar_url":"https://avatars.githubusercontent.com/u/1786612?v=3","gravatar_id":"","url":"https://api.github.com/users/krris","html_url":"https://github.com/krris","followers_url":"https://api.github.com/users/krris/followers","following_url":"https://api.github.com/users/krris/following{/other_user}","gists_url":"https://api.github.com/users/krris/gists{/gist_id}","starred_url":"https://api.github.com/users/krris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krris/subscriptions","organizations_url":"https://api.github.com/users/krris/orgs","repos_url":"https://api.github.com/users/krris/repos","events_url":"https://api.github.com/users/krris/events{/privacy}","received_events_url":"https://api.github.com/users/krris/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls/170/commits","review_comments_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls/170/comments","review_comment_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls/comments{/number}","comments_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/issues/170/comments","statuses_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/statuses/15c7a4f7695512c62f60049f08f4e94ef29e3762","head":{"label":"macoscope:feature/make-widget-template-view-reusable","ref":"feature/make-widget-template-view-reusable","sha":"15c7a4f7695512c62f60049f08f4e94ef29e3762","user":{"login":"macoscope","id":759101,"avatar_url":"https://avatars.githubusercontent.com/u/759101?v=3","gravatar_id":"","url":"https://api.github.com/users/macoscope","html_url":"https://github.com/macoscope","followers_url":"https://api.github.com/users/macoscope/followers","following_url":"https://api.github.com/users/macoscope/following{/other_user}","gists_url":"https://api.github.com/users/macoscope/gists{/gist_id}","starred_url":"https://api.github.com/users/macoscope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macoscope/subscriptions","organizations_url":"https://api.github.com/users/macoscope/orgs","repos_url":"https://api.github.com/users/macoscope/repos","events_url":"https://api.github.com/users/macoscope/events{/privacy}","received_events_url":"https://api.github.com/users/macoscope/received_events","type":"Organization","site_admin":false},"repo":{"id":49216533,"name":"GrandCentralBoard","full_name":"macoscope/GrandCentralBoard","owner":{"login":"macoscope","id":759101,"avatar_url":"https://avatars.githubusercontent.com/u/759101?v=3","gravatar_id":"","url":"https://api.github.com/users/macoscope","html_url":"https://github.com/macoscope","followers_url":"https://api.github.com/users/macoscope/followers","following_url":"https://api.github.com/users/macoscope/following{/other_user}","gists_url":"https://api.github.com/users/macoscope/gists{/gist_id}","starred_url":"https://api.github.com/users/macoscope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macoscope/subscriptions","organizations_url":"https://api.github.com/users/macoscope/orgs","repos_url":"https://api.github.com/users/macoscope/repos","events_url":"https://api.github.com/users/macoscope/events{/privacy}","received_events_url":"https://api.github.com/users/macoscope/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/macoscope/GrandCentralBoard","description":"Hang a TV in your open space or team room to show everyone what's up and get them up to speed.","fork":false,"url":"https://api.github.com/repos/macoscope/GrandCentralBoard","forks_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/forks","keys_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/teams","hooks_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/hooks","issue_events_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/issues/events{/number}","events_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/events","assignees_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/assignees{/user}","branches_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/branches{/branch}","tags_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/tags","blobs_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/git/refs{/sha}","trees_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/statuses/{sha}","languages_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/languages","stargazers_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/stargazers","contributors_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/contributors","subscribers_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/subscribers","subscription_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/subscription","commits_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/commits{/sha}","git_commits_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/git/commits{/sha}","comments_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/comments{/number}","issue_comment_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/issues/comments{/number}","contents_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/contents/{+path}","compare_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/merges","archive_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/downloads","issues_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/issues{/number}","pulls_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls{/number}","milestones_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/milestones{/number}","notifications_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/labels{/name}","releases_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/releases{/id}","deployments_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/deployments","created_at":"2016-01-07T16:35:08Z","updated_at":"2016-06-02T21:52:19Z","pushed_at":"2016-06-02T16:07:54Z","git_url":"git://github.com/macoscope/GrandCentralBoard.git","ssh_url":"git@github.com:macoscope/GrandCentralBoard.git","clone_url":"https://github.com/macoscope/GrandCentralBoard.git","svn_url":"https://github.com/macoscope/GrandCentralBoard","homepage":"http://macoscope.com/blog/grand-central-board-for-the-apple-tv/","size":12035,"stargazers_count":172,"watchers_count":172,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":13,"forks":10,"open_issues":13,"watchers":172,"default_branch":"develop"}},"base":{"label":"macoscope:develop","ref":"develop","sha":"d7db50e73cb7e0353c211dd07acaf61a6669f9b7","user":{"login":"macoscope","id":759101,"avatar_url":"https://avatars.githubusercontent.com/u/759101?v=3","gravatar_id":"","url":"https://api.github.com/users/macoscope","html_url":"https://github.com/macoscope","followers_url":"https://api.github.com/users/macoscope/followers","following_url":"https://api.github.com/users/macoscope/following{/other_user}","gists_url":"https://api.github.com/users/macoscope/gists{/gist_id}","starred_url":"https://api.github.com/users/macoscope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macoscope/subscriptions","organizations_url":"https://api.github.com/users/macoscope/orgs","repos_url":"https://api.github.com/users/macoscope/repos","events_url":"https://api.github.com/users/macoscope/events{/privacy}","received_events_url":"https://api.github.com/users/macoscope/received_events","type":"Organization","site_admin":false},"repo":{"id":49216533,"name":"GrandCentralBoard","full_name":"macoscope/GrandCentralBoard","owner":{"login":"macoscope","id":759101,"avatar_url":"https://avatars.githubusercontent.com/u/759101?v=3","gravatar_id":"","url":"https://api.github.com/users/macoscope","html_url":"https://github.com/macoscope","followers_url":"https://api.github.com/users/macoscope/followers","following_url":"https://api.github.com/users/macoscope/following{/other_user}","gists_url":"https://api.github.com/users/macoscope/gists{/gist_id}","starred_url":"https://api.github.com/users/macoscope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macoscope/subscriptions","organizations_url":"https://api.github.com/users/macoscope/orgs","repos_url":"https://api.github.com/users/macoscope/repos","events_url":"https://api.github.com/users/macoscope/events{/privacy}","received_events_url":"https://api.github.com/users/macoscope/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/macoscope/GrandCentralBoard","description":"Hang a TV in your open space or team room to show everyone what's up and get them up to speed.","fork":false,"url":"https://api.github.com/repos/macoscope/GrandCentralBoard","forks_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/forks","keys_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/teams","hooks_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/hooks","issue_events_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/issues/events{/number}","events_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/events","assignees_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/assignees{/user}","branches_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/branches{/branch}","tags_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/tags","blobs_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/git/refs{/sha}","trees_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/statuses/{sha}","languages_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/languages","stargazers_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/stargazers","contributors_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/contributors","subscribers_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/subscribers","subscription_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/subscription","commits_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/commits{/sha}","git_commits_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/git/commits{/sha}","comments_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/comments{/number}","issue_comment_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/issues/comments{/number}","contents_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/contents/{+path}","compare_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/merges","archive_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/downloads","issues_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/issues{/number}","pulls_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls{/number}","milestones_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/milestones{/number}","notifications_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/labels{/name}","releases_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/releases{/id}","deployments_url":"https://api.github.com/repos/macoscope/GrandCentralBoard/deployments","created_at":"2016-01-07T16:35:08Z","updated_at":"2016-06-02T21:52:19Z","pushed_at":"2016-06-02T16:07:54Z","git_url":"git://github.com/macoscope/GrandCentralBoard.git","ssh_url":"git@github.com:macoscope/GrandCentralBoard.git","clone_url":"https://github.com/macoscope/GrandCentralBoard.git","svn_url":"https://github.com/macoscope/GrandCentralBoard","homepage":"http://macoscope.com/blog/grand-central-board-for-the-apple-tv/","size":12035,"stargazers_count":172,"watchers_count":172,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":13,"forks":10,"open_issues":13,"watchers":172,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls/170"},"html":{"href":"https://github.com/macoscope/GrandCentralBoard/pull/170"},"issue":{"href":"https://api.github.com/repos/macoscope/GrandCentralBoard/issues/170"},"comments":{"href":"https://api.github.com/repos/macoscope/GrandCentralBoard/issues/170/comments"},"review_comments":{"href":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls/170/comments"},"review_comment":{"href":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/macoscope/GrandCentralBoard/pulls/170/commits"},"statuses":{"href":"https://api.github.com/repos/macoscope/GrandCentralBoard/statuses/15c7a4f7695512c62f60049f08f4e94ef29e3762"}}}}
{"actor":{"display_login":"krris"}}