{"action":"created","comment":{"url":"https://api.github.com/repos/robb/Cartography/pulls/comments/77225896","id":77225896,"diff_hunk":"@@ -0,0 +1,130 @@\n+import Cartography\n+\n+import Nimble\n+import Quick\n+import UIKit\n+\n+class LayoutSupportSpec: QuickSpec {\n+    override func spec() {\n+        var window: TestWindow!\n+        var view: TestView!\n+        var viewController: UIViewController!\n+        var navigationController: UINavigationController!\n+        var tabBarController: UITabBarController!\n+\n+        beforeEach {\n+            window = TestWindow(frame: CGRectMake(0,0,400,400))\n+            \n+            view = TestView(frame: CGRectZero)\n+            \n+            viewController = UIViewController()\n+            viewController.view.addSubview(view)\n+            \n+            constrain(view) { view in\n+                view.height == 200\n+                view.width == 200\n+            }\n+            \n+            navigationController = UINavigationController(rootViewController: viewController)\n+            tabBarController = UITabBarController()\n+            tabBarController.viewControllers = [navigationController]\n+            tabBarController.view.frame = window.bounds\n+            tabBarController.view.layoutIfNeeded()\n+            window.rootViewController = tabBarController\n+            \n+            window.setNeedsLayout()\n+            window.layoutIfNeeded()\n+            \n+            print(viewController.topLayoutGuide.debugDescription)\n+        }\n+        \n+        describe(\"LayoutSupport.top\") {\n+            it(\"should support relative equalities\") {\n+                \n+                viewController.view.layoutIfNeeded()\n+\n+                constrain(view) { view in\n+                    view.top == viewController.topLayoutGuideCartography\n+                }\n+                viewController.view.layoutIfNeeded()\n+                \n+                expect(view.convertRect(view.bounds, toView: window).minY).to(equal(viewController.topLayoutGuide.length))\n+            }\n+            \n+            it(\"should support relative inequalities\") {\n+                constrain(view) { view in\n+                    view.top <= viewController.topLayoutGuideCartography\n+                    view.top >= viewController.topLayoutGuideCartography\n+                }\n+                \n+                viewController.view.layoutIfNeeded()\n+                \n+                expect(view.convertRect(view.bounds, toView: window).minY).to(equal(viewController.topLayoutGuide.length))\n+            }\n+            \n+            it(\"should support addition\") {\n+                constrain(view) { view in\n+                    view.top == viewController.topLayoutGuideCartography + 100\n+                }\n+                \n+                viewController.view.layoutIfNeeded()\n+                \n+                expect(view.convertRect(view.bounds, toView: window).minY).to(equal(100 + viewController.topLayoutGuide.length))\n+            }\n+            \n+            it(\"should support subtraction\") {\n+                constrain(view) { view in\n+                    view.top == viewController.topLayoutGuideCartography - 100\n+                }\n+                \n+                viewController.view.layoutIfNeeded()\n+                \n+                expect(view.convertRect(view.bounds, toView: window).minY).to(equal(-100 - viewController.topLayoutGuide.length))\n+            }\n+        }\n+        \n+        describe(\"LayoutSupport.bottom\") {\n+            it(\"should support relative equalities\") {\n+                constrain(view) { view in\n+                    view.bottom == viewController.bottomLayoutGuideCartography\n+                }\n+                viewController.view.layoutIfNeeded()\n+                \n+                expect(view.convertRect(view.bounds, toView: window).maxY).to(equal(window.bounds.maxY - viewController.bottomLayoutGuide.length))\n+            }\n+            \n+            it(\"should support relative inequalities\") {\n+                constrain(view) { view in\n+                    view.bottom <= viewController.bottomLayoutGuideCartography\n+                    view.bottom >= viewController.bottomLayoutGuideCartography\n+                }\n+                \n+                viewController.view.layoutIfNeeded()\n+                \n+                expect(view.convertRect(view.bounds, toView: window).maxY).to(equal(window.bounds.maxY - viewController.bottomLayoutGuide.length))\n+            }\n+            \n+            it(\"should support addition\") {\n+                constrain(view) { view in\n+                    view.bottom == viewController.bottomLayoutGuideCartography + 100\n+                }\n+                \n+                viewController.view.layoutIfNeeded()\n+                \n+                expect(view.convertRect(view.bounds, toView: window).maxY).to(equal(100 + window.bounds.maxY - viewController.bottomLayoutGuide.length))\n+            }\n+            \n+            it(\"should support subtraction\") {\n+                constrain(view) { view in\n+                    view.bottom == viewController.bottomLayoutGuideCartography - 100\n+                }\n+                \n+                viewController.view.layoutIfNeeded()\n+                \n+                expect(view.convertRect(view.bounds, toView: window).maxY).to(equal((window.bounds.maxY - 100) - viewController.bottomLayoutGuide.length))\n+            }\n+            \n+        }\n+\n+    }\n+}","path":"CartographyTests/LayoutSupportSpec.swift","position":130,"original_position":130,"commit_id":"54e3d084242882efc7de79097f9afc3c27dd58a4","original_commit_id":"54e3d084242882efc7de79097f9afc3c27dd58a4","user":{"login":"robb","id":212465,"avatar_url":"https://avatars.githubusercontent.com/u/212465?v=3","gravatar_id":"","url":"https://api.github.com/users/robb","html_url":"https://github.com/robb","followers_url":"https://api.github.com/users/robb/followers","following_url":"https://api.github.com/users/robb/following{/other_user}","gists_url":"https://api.github.com/users/robb/gists{/gist_id}","starred_url":"https://api.github.com/users/robb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robb/subscriptions","organizations_url":"https://api.github.com/users/robb/orgs","repos_url":"https://api.github.com/users/robb/repos","events_url":"https://api.github.com/users/robb/events{/privacy}","received_events_url":"https://api.github.com/users/robb/received_events","type":"User","site_admin":false},"body":"Nitpick: missing new line","created_at":"2016-09-01T18:16:27Z","updated_at":"2016-09-01T18:16:27Z","html_url":"https://github.com/robb/Cartography/pull/203#discussion_r77225896","pull_request_url":"https://api.github.com/repos/robb/Cartography/pulls/203","_links":{"self":{"href":"https://api.github.com/repos/robb/Cartography/pulls/comments/77225896"},"html":{"href":"https://github.com/robb/Cartography/pull/203#discussion_r77225896"},"pull_request":{"href":"https://api.github.com/repos/robb/Cartography/pulls/203"}}},"pull_request":{"url":"https://api.github.com/repos/robb/Cartography/pulls/203","id":64614629,"html_url":"https://github.com/robb/Cartography/pull/203","diff_url":"https://github.com/robb/Cartography/pull/203.diff","patch_url":"https://github.com/robb/Cartography/pull/203.patch","issue_url":"https://api.github.com/repos/robb/Cartography/issues/203","number":203,"state":"open","locked":false,"title":"Add UILayoutSupport support","user":{"login":"TimothyChilvers","id":1138635,"avatar_url":"https://avatars.githubusercontent.com/u/1138635?v=3","gravatar_id":"","url":"https://api.github.com/users/TimothyChilvers","html_url":"https://github.com/TimothyChilvers","followers_url":"https://api.github.com/users/TimothyChilvers/followers","following_url":"https://api.github.com/users/TimothyChilvers/following{/other_user}","gists_url":"https://api.github.com/users/TimothyChilvers/gists{/gist_id}","starred_url":"https://api.github.com/users/TimothyChilvers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimothyChilvers/subscriptions","organizations_url":"https://api.github.com/users/TimothyChilvers/orgs","repos_url":"https://api.github.com/users/TimothyChilvers/repos","events_url":"https://api.github.com/users/TimothyChilvers/events{/privacy}","received_events_url":"https://api.github.com/users/TimothyChilvers/received_events","type":"User","site_admin":false},"body":"Hope you don't mind my taking a stab at this. It's based on the examples in https://github.com/robb/Cartography/issues/95 and admittedly it doesn't quite match the framework pattern, but it's here if you want it.","created_at":"2016-03-30T11:54:44Z","updated_at":"2016-09-01T18:16:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1696fbfe574cd5a891511e0e6bd1cd4d935dccc4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/robb/Cartography/pulls/203/commits","review_comments_url":"https://api.github.com/repos/robb/Cartography/pulls/203/comments","review_comment_url":"https://api.github.com/repos/robb/Cartography/pulls/comments{/number}","comments_url":"https://api.github.com/repos/robb/Cartography/issues/203/comments","statuses_url":"https://api.github.com/repos/robb/Cartography/statuses/54e3d084242882efc7de79097f9afc3c27dd58a4","head":{"label":"TimothyChilvers:master","ref":"master","sha":"54e3d084242882efc7de79097f9afc3c27dd58a4","user":{"login":"TimothyChilvers","id":1138635,"avatar_url":"https://avatars.githubusercontent.com/u/1138635?v=3","gravatar_id":"","url":"https://api.github.com/users/TimothyChilvers","html_url":"https://github.com/TimothyChilvers","followers_url":"https://api.github.com/users/TimothyChilvers/followers","following_url":"https://api.github.com/users/TimothyChilvers/following{/other_user}","gists_url":"https://api.github.com/users/TimothyChilvers/gists{/gist_id}","starred_url":"https://api.github.com/users/TimothyChilvers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimothyChilvers/subscriptions","organizations_url":"https://api.github.com/users/TimothyChilvers/orgs","repos_url":"https://api.github.com/users/TimothyChilvers/repos","events_url":"https://api.github.com/users/TimothyChilvers/events{/privacy}","received_events_url":"https://api.github.com/users/TimothyChilvers/received_events","type":"User","site_admin":false},"repo":{"id":54985228,"name":"Cartography","full_name":"TimothyChilvers/Cartography","owner":{"login":"TimothyChilvers","id":1138635,"avatar_url":"https://avatars.githubusercontent.com/u/1138635?v=3","gravatar_id":"","url":"https://api.github.com/users/TimothyChilvers","html_url":"https://github.com/TimothyChilvers","followers_url":"https://api.github.com/users/TimothyChilvers/followers","following_url":"https://api.github.com/users/TimothyChilvers/following{/other_user}","gists_url":"https://api.github.com/users/TimothyChilvers/gists{/gist_id}","starred_url":"https://api.github.com/users/TimothyChilvers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimothyChilvers/subscriptions","organizations_url":"https://api.github.com/users/TimothyChilvers/orgs","repos_url":"https://api.github.com/users/TimothyChilvers/repos","events_url":"https://api.github.com/users/TimothyChilvers/events{/privacy}","received_events_url":"https://api.github.com/users/TimothyChilvers/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TimothyChilvers/Cartography","description":"A declarative Auto Layout DSL for Swift :iphone::triangular_ruler:","fork":true,"url":"https://api.github.com/repos/TimothyChilvers/Cartography","forks_url":"https://api.github.com/repos/TimothyChilvers/Cartography/forks","keys_url":"https://api.github.com/repos/TimothyChilvers/Cartography/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TimothyChilvers/Cartography/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TimothyChilvers/Cartography/teams","hooks_url":"https://api.github.com/repos/TimothyChilvers/Cartography/hooks","issue_events_url":"https://api.github.com/repos/TimothyChilvers/Cartography/issues/events{/number}","events_url":"https://api.github.com/repos/TimothyChilvers/Cartography/events","assignees_url":"https://api.github.com/repos/TimothyChilvers/Cartography/assignees{/user}","branches_url":"https://api.github.com/repos/TimothyChilvers/Cartography/branches{/branch}","tags_url":"https://api.github.com/repos/TimothyChilvers/Cartography/tags","blobs_url":"https://api.github.com/repos/TimothyChilvers/Cartography/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TimothyChilvers/Cartography/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TimothyChilvers/Cartography/git/refs{/sha}","trees_url":"https://api.github.com/repos/TimothyChilvers/Cartography/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TimothyChilvers/Cartography/statuses/{sha}","languages_url":"https://api.github.com/repos/TimothyChilvers/Cartography/languages","stargazers_url":"https://api.github.com/repos/TimothyChilvers/Cartography/stargazers","contributors_url":"https://api.github.com/repos/TimothyChilvers/Cartography/contributors","subscribers_url":"https://api.github.com/repos/TimothyChilvers/Cartography/subscribers","subscription_url":"https://api.github.com/repos/TimothyChilvers/Cartography/subscription","commits_url":"https://api.github.com/repos/TimothyChilvers/Cartography/commits{/sha}","git_commits_url":"https://api.github.com/repos/TimothyChilvers/Cartography/git/commits{/sha}","comments_url":"https://api.github.com/repos/TimothyChilvers/Cartography/comments{/number}","issue_comment_url":"https://api.github.com/repos/TimothyChilvers/Cartography/issues/comments{/number}","contents_url":"https://api.github.com/repos/TimothyChilvers/Cartography/contents/{+path}","compare_url":"https://api.github.com/repos/TimothyChilvers/Cartography/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TimothyChilvers/Cartography/merges","archive_url":"https://api.github.com/repos/TimothyChilvers/Cartography/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TimothyChilvers/Cartography/downloads","issues_url":"https://api.github.com/repos/TimothyChilvers/Cartography/issues{/number}","pulls_url":"https://api.github.com/repos/TimothyChilvers/Cartography/pulls{/number}","milestones_url":"https://api.github.com/repos/TimothyChilvers/Cartography/milestones{/number}","notifications_url":"https://api.github.com/repos/TimothyChilvers/Cartography/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TimothyChilvers/Cartography/labels{/name}","releases_url":"https://api.github.com/repos/TimothyChilvers/Cartography/releases{/id}","deployments_url":"https://api.github.com/repos/TimothyChilvers/Cartography/deployments","created_at":"2016-03-29T14:59:50Z","updated_at":"2016-03-29T14:59:51Z","pushed_at":"2016-08-19T17:03:39Z","git_url":"git://github.com/TimothyChilvers/Cartography.git","ssh_url":"git@github.com:TimothyChilvers/Cartography.git","clone_url":"https://github.com/TimothyChilvers/Cartography.git","svn_url":"https://github.com/TimothyChilvers/Cartography","homepage":"","size":1252,"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":"robb:master","ref":"master","sha":"435a0fcbb93a4adf691a94706c3f40823b3e5044","user":{"login":"robb","id":212465,"avatar_url":"https://avatars.githubusercontent.com/u/212465?v=3","gravatar_id":"","url":"https://api.github.com/users/robb","html_url":"https://github.com/robb","followers_url":"https://api.github.com/users/robb/followers","following_url":"https://api.github.com/users/robb/following{/other_user}","gists_url":"https://api.github.com/users/robb/gists{/gist_id}","starred_url":"https://api.github.com/users/robb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robb/subscriptions","organizations_url":"https://api.github.com/users/robb/orgs","repos_url":"https://api.github.com/users/robb/repos","events_url":"https://api.github.com/users/robb/events{/privacy}","received_events_url":"https://api.github.com/users/robb/received_events","type":"User","site_admin":false},"repo":{"id":20940824,"name":"Cartography","full_name":"robb/Cartography","owner":{"login":"robb","id":212465,"avatar_url":"https://avatars.githubusercontent.com/u/212465?v=3","gravatar_id":"","url":"https://api.github.com/users/robb","html_url":"https://github.com/robb","followers_url":"https://api.github.com/users/robb/followers","following_url":"https://api.github.com/users/robb/following{/other_user}","gists_url":"https://api.github.com/users/robb/gists{/gist_id}","starred_url":"https://api.github.com/users/robb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robb/subscriptions","organizations_url":"https://api.github.com/users/robb/orgs","repos_url":"https://api.github.com/users/robb/repos","events_url":"https://api.github.com/users/robb/events{/privacy}","received_events_url":"https://api.github.com/users/robb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robb/Cartography","description":"A declarative Auto Layout DSL for Swift :iphone::triangular_ruler:","fork":false,"url":"https://api.github.com/repos/robb/Cartography","forks_url":"https://api.github.com/repos/robb/Cartography/forks","keys_url":"https://api.github.com/repos/robb/Cartography/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robb/Cartography/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robb/Cartography/teams","hooks_url":"https://api.github.com/repos/robb/Cartography/hooks","issue_events_url":"https://api.github.com/repos/robb/Cartography/issues/events{/number}","events_url":"https://api.github.com/repos/robb/Cartography/events","assignees_url":"https://api.github.com/repos/robb/Cartography/assignees{/user}","branches_url":"https://api.github.com/repos/robb/Cartography/branches{/branch}","tags_url":"https://api.github.com/repos/robb/Cartography/tags","blobs_url":"https://api.github.com/repos/robb/Cartography/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robb/Cartography/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robb/Cartography/git/refs{/sha}","trees_url":"https://api.github.com/repos/robb/Cartography/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robb/Cartography/statuses/{sha}","languages_url":"https://api.github.com/repos/robb/Cartography/languages","stargazers_url":"https://api.github.com/repos/robb/Cartography/stargazers","contributors_url":"https://api.github.com/repos/robb/Cartography/contributors","subscribers_url":"https://api.github.com/repos/robb/Cartography/subscribers","subscription_url":"https://api.github.com/repos/robb/Cartography/subscription","commits_url":"https://api.github.com/repos/robb/Cartography/commits{/sha}","git_commits_url":"https://api.github.com/repos/robb/Cartography/git/commits{/sha}","comments_url":"https://api.github.com/repos/robb/Cartography/comments{/number}","issue_comment_url":"https://api.github.com/repos/robb/Cartography/issues/comments{/number}","contents_url":"https://api.github.com/repos/robb/Cartography/contents/{+path}","compare_url":"https://api.github.com/repos/robb/Cartography/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robb/Cartography/merges","archive_url":"https://api.github.com/repos/robb/Cartography/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robb/Cartography/downloads","issues_url":"https://api.github.com/repos/robb/Cartography/issues{/number}","pulls_url":"https://api.github.com/repos/robb/Cartography/pulls{/number}","milestones_url":"https://api.github.com/repos/robb/Cartography/milestones{/number}","notifications_url":"https://api.github.com/repos/robb/Cartography/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robb/Cartography/labels{/name}","releases_url":"https://api.github.com/repos/robb/Cartography/releases{/id}","deployments_url":"https://api.github.com/repos/robb/Cartography/deployments","created_at":"2014-06-17T21:54:48Z","updated_at":"2016-09-01T13:44:54Z","pushed_at":"2016-08-19T17:03:39Z","git_url":"git://github.com/robb/Cartography.git","ssh_url":"git@github.com:robb/Cartography.git","clone_url":"https://github.com/robb/Cartography.git","svn_url":"https://github.com/robb/Cartography","homepage":"","size":1333,"stargazers_count":4723,"watchers_count":4723,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":338,"mirror_url":null,"open_issues_count":48,"forks":338,"open_issues":48,"watchers":4723,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/robb/Cartography/pulls/203"},"html":{"href":"https://github.com/robb/Cartography/pull/203"},"issue":{"href":"https://api.github.com/repos/robb/Cartography/issues/203"},"comments":{"href":"https://api.github.com/repos/robb/Cartography/issues/203/comments"},"review_comments":{"href":"https://api.github.com/repos/robb/Cartography/pulls/203/comments"},"review_comment":{"href":"https://api.github.com/repos/robb/Cartography/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/robb/Cartography/pulls/203/commits"},"statuses":{"href":"https://api.github.com/repos/robb/Cartography/statuses/54e3d084242882efc7de79097f9afc3c27dd58a4"}}}}
{"actor":{"display_login":"robb"}}