{"action":"created","issue":{"url":"https://api.github.com/repos/mamaral/Facade/issues/18","labels_url":"https://api.github.com/repos/mamaral/Facade/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/mamaral/Facade/issues/18/comments","events_url":"https://api.github.com/repos/mamaral/Facade/issues/18/events","html_url":"https://github.com/mamaral/Facade/issues/18","id":95884174,"number":18,"title":"Here's a Swift Implementation!","user":{"login":"mpelham","id":320341,"avatar_url":"https://avatars.githubusercontent.com/u/320341?v=3","gravatar_id":"","url":"https://api.github.com/users/mpelham","html_url":"https://github.com/mpelham","followers_url":"https://api.github.com/users/mpelham/followers","following_url":"https://api.github.com/users/mpelham/following{/other_user}","gists_url":"https://api.github.com/users/mpelham/gists{/gist_id}","starred_url":"https://api.github.com/users/mpelham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpelham/subscriptions","organizations_url":"https://api.github.com/users/mpelham/orgs","repos_url":"https://api.github.com/users/mpelham/repos","events_url":"https://api.github.com/users/mpelham/events{/privacy}","received_events_url":"https://api.github.com/users/mpelham/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mamaral/Facade/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-19T04:21:46Z","updated_at":"2015-09-25T13:01:24Z","closed_at":"2015-09-25T13:01:24Z","body":"Here's a SWIFT implementation!\r\nIt may need some optimization love, but should be 100% compliant to modern SWIFT libs.\r\n(Anything Doubles Related needs looking into for perf sake at least.)\r\n\r\nSwift Version Below:\r\n\r\n```swift\r\n//\r\n//  UIView.swift+(Facade)\r\n//  Copyright Go Nuts and Have Fun!\r\n//\r\n\r\nimport Foundation\r\nimport UIKit\r\n\r\nextension UIView {\r\n    \r\n    func fCenter() -> CGPoint {\r\n        \r\n        var center = CGPoint(x: self.frame.midX - self.frame.minX,y: self.frame.midY - self.frame.minY);\r\n        \r\n        return center;\r\n    }\r\n    \r\n    func xMin() -> CGFloat {\r\n        return CGRectGetMinX(self.frame)\r\n    }\r\n    \r\n    func xMax() -> CGFloat {\r\n        return CGRectGetMaxX(self.frame)\r\n    }\r\n    \r\n    func yMin() -> CGFloat {\r\n        return CGRectGetMinY(self.frame)\r\n    }\r\n    \r\n    func yMax() -> CGFloat {\r\n        return CGRectGetMaxY(self.frame)\r\n    }\r\n    \r\n    func width() -> CGFloat {\r\n        return CGRectGetWidth(self.frame)\r\n    }\r\n    \r\n    func height() -> CGFloat {\r\n        return CGRectGetHeight(self.frame)\r\n    }\r\n    \r\n    func fillSuperview() {\r\n        self.frame = CGRectMake(0, 0, CGRectGetWidth(self.superview!.frame), CGRectGetHeight(self.superview!.frame))\r\n    }\r\n    \r\n    func anchorTopLeftWithLeftPadding(left: CGFloat, topPadding top: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(left, top, width, height)\r\n    }\r\n    \r\n    func anchorTopRightWithRightPadding(right: CGFloat, topPadding top: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetWidth(self.superview!.frame) - width - right, top, width, height)\r\n    }\r\n    \r\n    func anchorBottomLeftWithLeftPadding(left: CGFloat, bottomPadding bottom: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(left, CGRectGetHeight(self.superview!.frame) - height - bottom, width, height)\r\n    }\r\n    \r\n    func anchorBottomRightWithRightPadding(right: CGFloat, bottomPadding bottom: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetWidth(self.superview!.frame) - width - right, CGRectGetHeight(self.superview!.frame) - height - bottom, width, height)\r\n    }\r\n    \r\n    func anchorInCenterWithWidth(width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake((CGRectGetWidth(self.superview!.frame) / 2.0) - (width / 2.0), (CGRectGetHeight(self.superview!.frame) / 2.0) - (height / 2.0), width, height)\r\n    }\r\n    \r\n    func anchorCenterLeftWithLeftPadding(left: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(left, (CGRectGetHeight(self.superview!.frame) / 2.0) - (height / 2.0), width, height)\r\n    }\r\n    \r\n    func anchorCenterRightWithRightPadding(right: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetWidth(self.superview!.frame) - width - right, (CGRectGetHeight(self.superview!.frame) / 2.0) - (height / 2.0), width, height)\r\n    }\r\n    \r\n    func anchorTopCenterWithTopPadding(top: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake((CGRectGetWidth(self.superview!.frame) / 2.0) - (width / 2.0), top, width, height)\r\n    }\r\n    \r\n    func anchorBottomCenterWithBottomPadding(bottom: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake((CGRectGetWidth(self.superview!.frame) / 2.0) - (width / 2.0), CGRectGetHeight(self.superview!.frame) - height - bottom, width, height)\r\n    }\r\n    \r\n    func anchorInCenterFillingWidthAndHeightWithLeftAndRightPadding(leftAndRight: CGFloat, topAndBottomPadding topAndBottom: CGFloat) {\r\n        self.frame = CGRectMake(leftAndRight, topAndBottom, CGRectGetWidth(self.superview!.frame) - (2 * leftAndRight), CGRectGetHeight(self.superview!.frame) - (2 * topAndBottom))\r\n    }\r\n    \r\n    func anchorTopCenterFillingWidthWithLeftAndRightPadding(leftAndRight: CGFloat, topPadding top: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(leftAndRight, top, CGRectGetWidth(self.superview!.frame) - (2 * leftAndRight), height)\r\n    }\r\n    \r\n    func anchorBottomCenterFillingWidthWithLeftAndRightPadding(leftAndRight: CGFloat, bottomPadding bottom: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(leftAndRight, CGRectGetHeight(self.superview!.frame) - height - bottom, CGRectGetWidth(self.superview!.frame) - (2 * leftAndRight), height)\r\n    }\r\n    \r\n    func alignToTheRightOf(view: UIView, withLeftPadding left: CGFloat, topPadding top: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMaxX(view.frame) + left, top, width, height)\r\n    }\r\n    \r\n    func alignToTheRightOf(view: UIView, fillingWidthWithLeftAndRightPadding leftAndRight: CGFloat, topPadding top: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMaxX(view.frame) + leftAndRight, top, CGRectGetWidth(self.superview!.frame) - CGRectGetMaxX(view.frame) - (2 * leftAndRight), height)\r\n    }\r\n    \r\n    func alignToTheRightOf(view: UIView, matchingTopWithLeftPadding left: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMaxX(view.frame) + left, CGRectGetMinY(view.frame), width, height)\r\n    }\r\n    \r\n    func alignToTheRightOf(view: UIView, matchingTopAndFillingWidthWithLeftAndRightPadding leftAndRight: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMaxX(view.frame) + leftAndRight, CGRectGetMinY(view.frame), CGRectGetWidth(view.superview!.frame) - CGRectGetMaxX(view.frame) - (2 * leftAndRight), height)\r\n    }\r\n    \r\n    func alignToTheRightOf(view: UIView, matchingCenterWithLeftPadding left: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMaxX(view.frame) + left, CGRectGetMidY(view.frame) - (height / 2.0), width, height)\r\n    }\r\n    \r\n    func alignToTheRightOf(view: UIView, matchingCenterAndFillingWidthWithLeftAndRightPadding leftAndRight: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMaxX(view.frame) + leftAndRight, CGRectGetMidY(view.frame) - (height / 2.0), CGRectGetWidth(view.superview!.frame) - CGRectGetMaxX(view.frame) - (2 * leftAndRight), height)\r\n    }\r\n    \r\n    func alignToTheRightOf(view: UIView, matchingBottomWithLeftPadding left: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMaxX(view.frame) + left, CGRectGetMaxY(view.frame) - height, width, height)\r\n    }\r\n    \r\n    func alignToTheRightOf(view: UIView, matchingBottomAndFillingWidthWithLeftAndRightPadding leftAndRight: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMaxX(view.frame) + leftAndRight, CGRectGetMaxY(view.frame) - height, CGRectGetWidth(view.superview!.frame) - CGRectGetMaxX(view.frame) - (2 * leftAndRight), height)\r\n    }\r\n    \r\n    func alignToTheLeftOf(view: UIView, fillingWidthAndHeightWithLeftAndRightPadding leftAndRight: CGFloat, topAndBottomPadding topAndBottom: CGFloat) {\r\n        self.frame = CGRectMake(leftAndRight, topAndBottom, CGRectGetMinX(view.frame) - (2 * leftAndRight), CGRectGetHeight(self.superview!.frame) - (2 * topAndBottom))\r\n    }\r\n    \r\n    func alignToTheLeftOf(view: UIView, matchingTopWithRightPadding right: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMinX(view.frame) - width - right, CGRectGetMinY(view.frame), width, height)\r\n    }\r\n    \r\n    func alignToTheLeftOf(view: UIView, matchingTopAndFillingWidthWithLeftAndRightPadding leftAndRight: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(leftAndRight, CGRectGetMinY(view.frame), CGRectGetMinX(view.frame) - (2 * leftAndRight), height)\r\n    }\r\n    \r\n    func alignToTheLeftOf(view: UIView, matchingCenterWithRightPadding right: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMinX(view.frame) - width - right, CGRectGetMidY(view.frame) - (height / 2.0), width, height)\r\n    }\r\n    \r\n    func alignToTheLeftOf(view: UIView, matchingCenterAndFillingWidthWithLeftAndRightPadding leftAndRight: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(leftAndRight, CGRectGetMidY(view.frame) - (height / 2.0), CGRectGetMinX(view.frame) - (2 * leftAndRight), height)\r\n    }\r\n    \r\n    func alignToTheLeftOf(view: UIView, matchingBottomWithRightPadding right: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMinX(view.frame) - width - right, CGRectGetMaxY(view.frame) - height, width, height)\r\n    }\r\n    \r\n    func alignToTheLeftOf(view: UIView, matchingBottomAndFillingWidthWithLeftAndRightPadding leftAndRight: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(leftAndRight, CGRectGetMaxY(view.frame) - height, CGRectGetMinX(view.frame) - (2 * leftAndRight), height)\r\n    }\r\n    \r\n    func alignUnder(view: UIView, withLeftPadding left: CGFloat, topPadding top: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(left, CGRectGetMaxY(view.frame) + top, width, height)\r\n    }\r\n    \r\n    func alignUnder(view: UIView, withRightPadding right: CGFloat, topPadding top: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMaxX(self.superview!.frame) - width - right, CGRectGetMaxY(view.frame) + top, width, height)\r\n    }\r\n    \r\n    func alignUnder(view: UIView, matchingLeftWithTopPadding top: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMinX(view.frame), CGRectGetMaxY(view.frame) + top, width, height)\r\n    }\r\n    \r\n    func alignUnder(view: UIView, matchingLeftAndFillingWidthWithRightPadding right: CGFloat, topPadding top: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMinX(view.frame), CGRectGetMaxY(view.frame) + top, CGRectGetWidth(view.superview!.frame) - CGRectGetMinX(view.frame) - right, height)\r\n    }\r\n    \r\n    func alignUnder(view: UIView, matchingCenterWithTopPadding top: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMidX(view.frame) - (width / 2.0), CGRectGetMaxY(view.frame) + top, width, height)\r\n    }\r\n    \r\n    func alignUnder(view: UIView, centeredFillingWidthWithLeftAndRightPadding leftAndRight: CGFloat, topPadding top: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(leftAndRight, CGRectGetMaxY(view.frame) + top, CGRectGetWidth(view.superview!.frame) - (2 * leftAndRight), height)\r\n    }\r\n    \r\n    func alignUnder(view: UIView, centeredFillingWidthAndHeightWithLeftAndRightPadding leftAndRight: CGFloat, topAndBottomPadding topAndBottom: CGFloat) {\r\n        self.frame = CGRectMake(leftAndRight, CGRectGetMaxY(view.frame) + topAndBottom, CGRectGetWidth(view.superview!.frame) - (2 * leftAndRight), CGRectGetHeight(self.superview!.frame) - CGRectGetMaxY(view.frame) - topAndBottom - topAndBottom)\r\n    }\r\n    \r\n    func alignUnder(view: UIView, matchingRightWithTopPadding top: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMaxX(view.frame) - width, CGRectGetMaxY(view.frame) + top, width, height)\r\n    }\r\n    \r\n    func alignUnder(view: UIView, matchingRightAndFillingWidthWithLeftPadding left: CGFloat, topPadding top: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(left, CGRectGetMaxY(view.frame) + top, CGRectGetMinX(view.frame) + CGRectGetWidth(view.frame) - left, height)\r\n    }\r\n    \r\n    func alignUnder(view: UIView, matchingLeftAndRightFillingHeightWithTopPadding top: CGFloat, bottomPadding bottom: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMinX(view.frame), CGRectGetMaxY(view.frame) + top, CGRectGetWidth(view.frame), CGRectGetHeight(self.superview!.frame) - CGRectGetMaxY(view.frame) - top - bottom)\r\n    }\r\n    \r\n    func alignUnder(view: UIView, matchingLeftFillingWidthAndHeightWithRightPadding right: CGFloat, topPadding top: CGFloat, bottomPadding bottom: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMinX(view.frame), CGRectGetMaxY(view.frame) + top, CGRectGetWidth(self.superview!.frame) - CGRectGetMinX(view.frame) - right, CGRectGetHeight(self.superview!.frame) - CGRectGetMaxY(view.frame) - top - bottom)\r\n    }\r\n    \r\n    func alignAbove(view: UIView, matchingLeftWithBottomPadding bottom: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMinX(view.frame), CGRectGetMinY(view.frame) - height - bottom, width, height)\r\n    }\r\n    \r\n    func alignAbove(view: UIView, matchingLeftAndFillingWidthWithRightPadding right: CGFloat, bottomPadding bottom: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMinX(view.frame), CGRectGetMinY(view.frame) - height - bottom, CGRectGetWidth(view.superview!.frame) - CGRectGetMinX(view.frame) - right, height)\r\n    }\r\n    \r\n    func alignAbove(view: UIView, matchingCenterWithBottomPadding bottom: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMidX(view.frame) - (width / 2.0), CGRectGetMinY(view.frame) - height - bottom, width, height)\r\n    }\r\n    \r\n    func alignAbove(view: UIView, fillingWidthWithLeftAndRightPadding leftAndRight: CGFloat, bottomPadding bottom: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(leftAndRight, CGRectGetMinY(view.frame) - height - bottom, CGRectGetWidth(view.superview!.frame) - (2 * leftAndRight), height)\r\n    }\r\n    \r\n    func alignAbove(view: UIView, matchingRightWithBottomPadding bottom: CGFloat, width: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(CGRectGetMaxX(view.frame) - width, CGRectGetMinY(view.frame) - height - bottom, width, height)\r\n    }\r\n    \r\n    func alignAbove(view: UIView, matchingRightAndFillingWidthWithLeftPadding left: CGFloat, bottomPadding bottom: CGFloat, height: CGFloat) {\r\n        self.frame = CGRectMake(left, CGRectGetMinY(view.frame) - height - bottom, CGRectGetMinX(view.frame) + CGRectGetWidth(view.frame) - left, height)\r\n    }\r\n    \r\n    func alignBetweenLeft(leftView: UIView, andRight rightView: UIView, matchingTopWithLeftAndRightPadding leftAndRight: CGFloat, height: CGFloat) {\r\n        var xOrigin: CGFloat = CGRectGetMaxX(leftView.frame) + leftAndRight\r\n        self.frame = CGRectMake(xOrigin, CGRectGetMinY(leftView.frame), CGRectGetWidth(self.superview!.frame) - xOrigin - (CGRectGetWidth(self.superview!.frame) - CGRectGetMinX(rightView.frame)) - leftAndRight, height)\r\n    }\r\n    \r\n    func alignBetweenLeft(leftView: UIView, andRight rightView: UIView, matchingCenterWithLeftAndRightPadding leftAndRight: CGFloat, height: CGFloat) {\r\n        var xOrigin: CGFloat = CGRectGetMaxX(leftView.frame) + leftAndRight\r\n        self.frame = CGRectMake(xOrigin, CGRectGetMidY(leftView.frame) - (height / 2.0), CGRectGetWidth(self.superview!.frame) - xOrigin - (CGRectGetWidth(self.superview!.frame) - CGRectGetMinX(rightView.frame)) - leftAndRight, height)\r\n    }\r\n    \r\n    func alignBetweenTop(topView: UIView, andBottom bottomView: UIView, matchingLeftWithTopAndBottomPadding topAndBottom: CGFloat, width: CGFloat) {\r\n        var yOrigin: CGFloat = CGRectGetMaxY(topView.frame) + topAndBottom\r\n        self.frame = CGRectMake(CGRectGetMinX(topView.frame), CGRectGetMaxY(topView.frame) + topAndBottom, width, CGRectGetHeight(self.superview!.frame) - yOrigin - (CGRectGetHeight(self.superview!.frame) - CGRectGetMinY(bottomView.frame)) - topAndBottom)\r\n    }\r\n    \r\n    func alignBetweenTop(topView: UIView, andBottom bottomView: UIView, centeredWithLeftAndRightPadding leftAndRight: CGFloat, topAndBottomPadding topAndBottom: CGFloat) {\r\n        self.frame = CGRectMake(leftAndRight, CGRectGetMaxY(topView.frame) + topAndBottom, CGRectGetWidth(self.superview!.frame) - (2 * leftAndRight), CGRectGetMinY(bottomView.frame) - CGRectGetMaxY(topView.frame) - (2 * topAndBottom))\r\n    }\r\n    \r\n    //Mark: Anything Referencing Doubles Below is My Stupid Fixes. Not required, and likely needing optimization.\r\n\r\n    func groupHorizontally(views: [UIView], centeredUnderView view: UIView, topPadding top: CGFloat, spacing: CGFloat, width: CGFloat, height: CGFloat) {\r\n        \r\n        var space:Double = Double(spacing);\r\n        var count:Double = Double(views.count);\r\n        var frameWidth:Double = Double(CGRectGetWidth(self.frame));\r\n        var maxWidth = Double(count) * Double(width);\r\n        var xO: Double = (frameWidth - (maxWidth) - ((count - 1) * space)) / 2.0\r\n\r\n        var xOrigin:CGFloat = CGFloat(xO);\r\n        \r\n        for subview: UIView in views {\r\n            subview.frame = CGRectMake(xOrigin, CGRectGetMaxY(view.frame) + top, width, height)\r\n            xOrigin += width + spacing\r\n        }\r\n    }\r\n    \r\n    func groupHorizontally(subviews: [UIView], fillingWidthAndHeightWithTopAndBottomPadding topAndBottom: CGFloat, spacing: CGFloat) {\r\n\r\n        var top:Double = Double(topAndBottom);\r\n        var space:Double = Double(spacing);\r\n        var subviewCount:Double = Double(subviews.count)\r\n        var frameWidth:Double = Double(CGRectGetWidth(self.frame));\r\n        var frameHeight:Double = Double(CGRectGetHeight(self.frame));\r\n        var w: Double = (frameWidth - ((subviewCount + 1) * space)) / subviewCount\r\n        var h: Double = frameHeight - (2 * top)\r\n\r\n        var xOrigin: CGFloat = spacing\r\n        var width:CGFloat = CGFloat(w);\r\n        var height:CGFloat = CGFloat(h);\r\n        \r\n        for subview: UIView in subviews {\r\n            subview.frame = CGRectMake(xOrigin, topAndBottom, width, height)\r\n            xOrigin += width + spacing\r\n        }\r\n    }\r\n\r\n    func groupHorizontally(views: [UIView], fillingHeightWithLeftPadding left: CGFloat, spacing: CGFloat, topAndBottomPadding topAndBottom: CGFloat, width: CGFloat) {\r\n        var xOrigin: CGFloat = left\r\n        var height: CGFloat = CGRectGetHeight(self.frame) - (2 * topAndBottom)\r\n        for subview: UIView in views {\r\n            subview.frame = CGRectMake(xOrigin, topAndBottom, width, height)\r\n            xOrigin += width + spacing\r\n        }\r\n    }\r\n    \r\n    \r\n    func groupVertically(subviews: [UIView], inUpperRightWithRightPadding right: CGFloat, topPadding top: CGFloat, spacing: CGFloat, width: CGFloat, height: CGFloat) {\r\n        var yOrigin: CGFloat = top\r\n        for view: UIView in subviews {\r\n            view.frame = CGRectMake(CGRectGetWidth(self.frame) - width - right, yOrigin, width, height)\r\n            yOrigin += height + spacing\r\n        }\r\n    }\r\n    \r\n    func groupVertically(subviews: [UIView], centerRightWithRightPadding right: CGFloat, spacing: CGFloat, width: CGFloat, height: CGFloat) {\r\n        \r\n        var frameHeight:Double = Double(CGRectGetHeight(self.frame));\r\n        var count = Double(subviews.count);\r\n        var h:Double = Double(height);\r\n        var maxHeight:Double = Double(count * h);\r\n        var space:Double = Double(spacing);\r\n        var yO:Double = (frameHeight - (maxHeight) - ((count - 1) * space)) / 2.0\r\n        \r\n        var yOrigin: CGFloat = CGFloat(yO);\r\n        \r\n        for view: UIView in subviews {\r\n            view.frame = CGRectMake(CGRectGetWidth(self.frame) - width - right, yOrigin, width, height)\r\n            yOrigin += height + spacing\r\n        }\r\n    }\r\n    \r\n    func groupVertically(subviews: [UIView], inLowerRightWithRightPadding right: CGFloat, bottomPadding bottom: CGFloat, spacing: CGFloat, width: CGFloat, height: CGFloat) {\r\n        \r\n        \r\n        var h:Double = Double(height);\r\n        var b:Double = Double(bottom);\r\n        var frameHeight:Double = Double(CGRectGetHeight(self.frame));\r\n        var yO:Double = Double(frameHeight - h - b);\r\n\r\n        var yOrigin: CGFloat = CGFloat(yO);\r\n        for view: UIView in subviews {\r\n            view.frame = CGRectMake(CGRectGetWidth(self.frame) - width - right, yOrigin, width, height)\r\n            yOrigin -= height + spacing\r\n        }\r\n    }\r\n    \r\n    func groupVertically(subviews: [UIView], inUpperLeftWithLeftPadding left: CGFloat, topPadding top: CGFloat, spacing: CGFloat, width: CGFloat, height: CGFloat) {\r\n        var yOrigin: CGFloat = top\r\n        for view: UIView in subviews {\r\n            view.frame = CGRectMake(left, yOrigin, width, height)\r\n            yOrigin += height + spacing\r\n        }\r\n    }\r\n    \r\n    func groupVertically(subviews: [UIView], centerLeftWithLeftPadding left: CGFloat, spacing: CGFloat, width: CGFloat, height: CGFloat) {\r\n        \r\n        var frameHeight:Double = Double(CGRectGetHeight(self.frame));\r\n        var count:Double = Double(subviews.count);\r\n        var h:Double = Double(height);\r\n        var maxHeight:Double = Double(count * h);\r\n        var space:Double = Double(spacing);\r\n        var yO:Double = (frameHeight - (maxHeight) - ((count - 1) * space)) / 2.0\r\n        \r\n        var yOrigin: CGFloat = CGFloat(yO);\r\n        for view: UIView in subviews {\r\n            view.frame = CGRectMake(left, yOrigin, width, height)\r\n            yOrigin += height + spacing\r\n        }\r\n    }\r\n    \r\n    func groupVertically(subviews: [UIView], inLowerLeftWithLeftPadding left: CGFloat, bottomPadding bottom: CGFloat, spacing: CGFloat, width: CGFloat, height: CGFloat) {\r\n        var yOrigin: CGFloat = CGRectGetHeight(self.frame) - height - bottom\r\n        for view: UIView in subviews {\r\n            view.frame = CGRectMake(left, yOrigin, width, height)\r\n            yOrigin -= height + spacing\r\n        }\r\n    }\r\n    \r\n    func groupVertically(subviews: [UIView], topCenterWithTopPadding top: CGFloat, spacing: CGFloat, width: CGFloat, height: CGFloat) {\r\n        var yOrigin: CGFloat = top\r\n        for view: UIView in subviews {\r\n            view.frame = CGRectMake((CGRectGetWidth(self.frame) / 2.0) - (width / 2.0), yOrigin, width, height)\r\n            yOrigin += height + spacing\r\n        }\r\n    }\r\n    \r\n    func groupVertically(subviews: [UIView], centerWithSpacing spacing: CGFloat, width: CGFloat, height: CGFloat) {\r\n        \r\n        var frameHeight:Double = Double(CGRectGetHeight(self.frame));\r\n        var count:Double = Double(subviews.count);\r\n        var h: Double = Double(height);\r\n        var maxHeight:Double = Double(count * h);\r\n        var space:Double = Double(spacing);\r\n        var yO:Double = Double((frameHeight - (maxHeight) - ((count - 1) * space)) / 2.0)\r\n        \r\n        var yOrigin: CGFloat = CGFloat(yO);\r\n        for view: UIView in subviews {\r\n            view.frame = CGRectMake((CGRectGetWidth(self.frame) / 2.0) - (width / 2.0), yOrigin, width, height)\r\n            yOrigin += height + spacing\r\n        }\r\n    }\r\n    \r\n    func groupVertically(subviews: [UIView], bottomCenterWithBottomPadding bottom: CGFloat, spacing: CGFloat, width: CGFloat, height: CGFloat) {\r\n        var yOrigin: CGFloat = CGRectGetHeight(self.frame) - height - bottom\r\n        for view: UIView in subviews {\r\n            view.frame = CGRectMake((CGRectGetWidth(self.frame) / 2.0) - (width / 2.0), yOrigin, width, height)\r\n            yOrigin -= height + spacing\r\n        }\r\n    }\r\n    \r\n    func groupGrid(subviews: [UIView], fillingWidthWithColumnCount columnCount: UInt, spacing: CGFloat) {\r\n        var currentColumn: UInt = 0\r\n        var xOrigin: CGFloat = spacing\r\n        var yOrigin: CGFloat = spacing\r\n\r\n        var frameWidth:Double = Double(CGRectGetWidth(self.frame));\r\n        var count:Double = Double(columnCount);\r\n        var space:Double = Double(spacing);\r\n        \r\n        var s:Double = Double((frameWidth - ((count + 1) * space) / count));\r\n        var size: CGFloat = CGFloat(s);\r\n        \r\n        var offset: CGFloat = size + spacing\r\n        for subview: UIView in subviews {\r\n            subview.frame = CGRectMake(xOrigin, yOrigin, size, size)\r\n            if currentColumn == columnCount - 1 {\r\n                currentColumn = 0\r\n                xOrigin = spacing\r\n                yOrigin += offset\r\n            }\r\n            else {\r\n                currentColumn++\r\n                xOrigin += offset\r\n            }\r\n        }\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/mamaral/Facade/issues/comments/143215338","html_url":"https://github.com/mamaral/Facade/issues/18#issuecomment-143215338","issue_url":"https://api.github.com/repos/mamaral/Facade/issues/18","id":143215338,"user":{"login":"mamaral","id":6086409,"avatar_url":"https://avatars.githubusercontent.com/u/6086409?v=3","gravatar_id":"","url":"https://api.github.com/users/mamaral","html_url":"https://github.com/mamaral","followers_url":"https://api.github.com/users/mamaral/followers","following_url":"https://api.github.com/users/mamaral/following{/other_user}","gists_url":"https://api.github.com/users/mamaral/gists{/gist_id}","starred_url":"https://api.github.com/users/mamaral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mamaral/subscriptions","organizations_url":"https://api.github.com/users/mamaral/orgs","repos_url":"https://api.github.com/users/mamaral/repos","events_url":"https://api.github.com/users/mamaral/events{/privacy}","received_events_url":"https://api.github.com/users/mamaral/received_events","type":"User","site_admin":false},"created_at":"2015-09-25T13:01:24Z","updated_at":"2015-09-25T13:01:24Z","body":"So I ended up pivoting, and redesigning the logic and APIs for a different swift implementation with slightly more succinct. (And fewer) functions - https://github.com/mamaral/Neon.\r\n\r\nI appreciate your help!"}}