{"action":"created","issue":{"url":"https://api.github.com/repos/SnapKit/Masonry/issues/344","repository_url":"https://api.github.com/repos/SnapKit/Masonry","labels_url":"https://api.github.com/repos/SnapKit/Masonry/issues/344/labels{/name}","comments_url":"https://api.github.com/repos/SnapKit/Masonry/issues/344/comments","events_url":"https://api.github.com/repos/SnapKit/Masonry/issues/344/events","html_url":"https://github.com/SnapKit/Masonry/issues/344","id":155419961,"number":344,"title":"Add Hugging and CompressionResistance Please","user":{"login":"iStarEternal","id":16184922,"avatar_url":"https://avatars.githubusercontent.com/u/16184922?v=3","gravatar_id":"","url":"https://api.github.com/users/iStarEternal","html_url":"https://github.com/iStarEternal","followers_url":"https://api.github.com/users/iStarEternal/followers","following_url":"https://api.github.com/users/iStarEternal/following{/other_user}","gists_url":"https://api.github.com/users/iStarEternal/gists{/gist_id}","starred_url":"https://api.github.com/users/iStarEternal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iStarEternal/subscriptions","organizations_url":"https://api.github.com/users/iStarEternal/orgs","repos_url":"https://api.github.com/users/iStarEternal/repos","events_url":"https://api.github.com/users/iStarEternal/events{/privacy}","received_events_url":"https://api.github.com/users/iStarEternal/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SnapKit/Masonry/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/SnapKit/Masonry/labels/help%20wanted","name":"help wanted","color":"0e8a16"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-05-18T05:33:13Z","updated_at":"2016-07-04T10:46:58Z","closed_at":null,"body":"**I want to add hugging constraint to a view now, but it is not elegant code to write so**\r\n\r\n```\r\n[self.footTitleSignBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {\r\n    make.left.equalTo(self.footView);\r\n    make.centerY.equalTo(self.footView.mas_centerY).offset(0);\r\n}];\r\n[self.footTitleSignBackgroundView setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];\r\n[self.footTitleSignBackgroundView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];\r\n```\r\n\r\n**I think you should add this syntax into Masonry**\r\n```\r\nmake.horizontal.huggingRequired()\r\nmake.horizontal.huggingHigh()\r\nmake.horizontal.huggingFittingSizeLevel()\r\nmake.horizontal.huggingLow()\r\nmake.vertical...\r\nmake.horizontal.compressionResistance...\r\nmake.vertical.compressionResistance...\r\n```"},"comment":{"url":"https://api.github.com/repos/SnapKit/Masonry/issues/comments/230262438","html_url":"https://github.com/SnapKit/Masonry/issues/344#issuecomment-230262438","issue_url":"https://api.github.com/repos/SnapKit/Masonry/issues/344","id":230262438,"user":{"login":"adubr","id":820352,"avatar_url":"https://avatars.githubusercontent.com/u/820352?v=3","gravatar_id":"","url":"https://api.github.com/users/adubr","html_url":"https://github.com/adubr","followers_url":"https://api.github.com/users/adubr/followers","following_url":"https://api.github.com/users/adubr/following{/other_user}","gists_url":"https://api.github.com/users/adubr/gists{/gist_id}","starred_url":"https://api.github.com/users/adubr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adubr/subscriptions","organizations_url":"https://api.github.com/users/adubr/orgs","repos_url":"https://api.github.com/users/adubr/repos","events_url":"https://api.github.com/users/adubr/events{/privacy}","received_events_url":"https://api.github.com/users/adubr/received_events","type":"User","site_admin":false},"created_at":"2016-07-04T10:46:58Z","updated_at":"2016-07-04T10:46:58Z","body":"Hey @robertjpayne,\r\n\r\nI'd like to contribute to this issue and prepare a PR. But first I'd like to discuss syntax, logic and probable caveats of the feature. Some of the discussion was started at #88, and @nickynick with @cloudkite pointed out that hugging and compression resistance are somehow out of Mansonry semantics, which is kind of true. On the other hand as far as I know there are underlying constraints to support these properties, though they aren't available to the user directly. I suppose there could be a workaround, like storing the hugging and compression resistance values in an instance of a specialized subclass of `MASConstraint` and applying/rolling them back when appropriate (i.e. `install` and `uninstall` methods). How does it sound to you?"}}
{"actor":{"display_login":"adubr"}}