     ///   - relation: A NSLayoutRelation (default = .equal)
     ///   - multiplier: The multiplier (default = 1)
     ///   - constant: The constant value (default = 0)
-    public func constrain(_ attribute: NSLayoutAttribute, to: UIView?, attribute toAttribute: NSLayoutAttribute, relation: NSLayoutRelation, multiplier: CGFloat = 1, constant: CGFloat = 0) {
-        NSLayoutConstraint.activate([
-            NSLayoutConstraint(item: self, attribute: attribute, relatedBy: relation, toItem: to, attribute: toAttribute, multiplier: multiplier, constant: constant)
-            ]
-        )
+    /// - Returns: The constraint that has been set
+    @discardableResult public func constrain(_ attribute: NSLayoutAttribute, to: UIView?, attribute toAttribute: NSLayoutAttribute, relation: NSLayoutRelation, multiplier: CGFloat = 1, constant: CGFloat = 0) -> NSLayoutConstraint {
+        let constraint = NSLayoutConstraint(item: self, attribute: attribute, relatedBy: relation, toItem: to, attribute: toAttribute, multiplier: multiplier, constant: constant)
+        NSLayoutConstraint.activate([constraint])
+        return constraint
     }
     
     /// Fits this view to the edges of another view
     ///
     /// - Parameter view: The UIView to which edges this view should be contrainted
-    public func constrainEdges(to view: UIView) {
+    /// - Returns: The constraints that have been set
+    @discardableResult public func constrainEdges(to view: UIView) -> [NSLayoutConstraint] {
         translatesAutoresizingMaskIntoConstraints = false
-        constrainEqual(attribute: .top, to: view)
-        constrainEqual(attribute: .leading, to: view)
-        constrainEqual(attribute: .trailing, to: view)
-        constrainEqual(attribute: .bottom, to: view)
+        var constraints: [NSLayoutConstraint] = []
+        constraints.append(constrainEqual(attribute: .top, to: view))
+        constraints.append(constrainEqual(attribute: .leading, to: view))
+        constraints.append(constrainEqual(attribute: .trailing, to: view))
+        constraints.append(constrainEqual(attribute: .bottom, to: view))
+        return constraints
     }
     
     /// Fits this view to the margins of another view
     ///
-    /// - Parameter view: The UIView to which margings this view should be contrainted 
-    public func constrainEdges(toMarginOf view: UIView) {
+    /// - Parameter view: The UIView to which margings this view should be contrainted
+    /// - Returns: The constraints that have been set
+    @discardableResult public func constrainEdges(toMarginOf view: UIView) -> [NSLayoutConstraint] {
         translatesAutoresizingMaskIntoConstraints = false
-        constrain(.top, to: view, attribute: .topMargin, relation: .equal)
-        constrain(.leading, to: view, attribute: .leadingMargin, relation: .equal)
-        constrain(.trailing, to: view, attribute: .trailingMargin, relation: .equal)
-        constrain(.bottom, to: view, attribute: .bottomMargin, relation: .equal)
+        var constraints: [NSLayoutConstraint] = []
+        constraints.append(constrain(.top, to: view, attribute: .topMargin, relation: .equal))
+        constraints.append(constrain(.leading, to: view, attribute: .leadingMargin, relation: .equal))
+        constraints.append(constrain(.trailing, to: view, attribute: .trailingMargin, relation: .equal))
+        constraints.append(constrain(.bottom, to: view, attribute: .bottomMargin, relation: .equal))
+        return constraints
     }
 }

import UIKit

extension UIView {
    
    /// Add an equal constraint from this view to another view
    ///
    /// - Parameters:

    ///   - to: Target object
    ///   - multiplier: The multiplier (default = 1)
    ///   - constant: The constant value (default = 0)
    /// - Returns: The constraint that has been set
    @discardableResult public func constrainGreaterThanOrEqual(attribute: NSLayoutAttribute, to: UIView, multiplier: CGFloat = 1, constant: CGFloat = 0) -> NSLayoutConstraint {
        return constrain(attribute, to: to, attribute: attribute, relation: .greaterThanOrEqual, multiplier: multiplier, constant: constant)
    }
    
    /// Add a constraint from this view to another view
