
/*
 ===============================================
 QUESTIONS:
 ===============================================
 - sizeToFit OR adjustSize or fitSize ?

 ===============================================
 TODO:
 ===============================================
 - Nice introduction https://github.com/stevestreza/Relayout

 - Add a doc example using width(40%).height(100%)
 - Add also an example using view.pin.top(25%).hCenter(0)

 - Add an image showing hCenter and vCenter (see http://doc.qt.io/qt-5/qtquick-positioning-anchors.html)

 - Optimization: Use a bit mask to check rapidly which properties has been set. ex: if propertiesMask & (TOP | BOTTOM) { ... }

 - Antoine Lamy: Suggestion pour ton système de layout (pt déjà le cas): Utiliser une interface entre l'engin de layout et
    UIKit afin de potentiellement être capable de le bridger vers d'autres entitées visuelles qu'une 
    UIView (exemple: CALayer, NSView, ASDisplayNode, etc). L'engin n'a probablement à dealer qu'avec des 
    primitives de CoreGraphics.

    Cette abstraction a été fait dans le framework d'animation POP ce qui fait qu'on peut virtuellement animer 
    n'importe quelle valeur, qu'elle soit liée à une vue ou pas. Ça rend le truc vraiment flexible.
        https://github.com/facebook/pop

 - pinEdgesHorizontal, pinEdgesVertical ??
 - pin.edges(), pin.horizontalEdges(), pin.verticalEdges(), 
   pin.all(), pin.allHorizontal(), pin.allVertical()
   pin.view.fill(), pin.fillHorizontally(), pin.fillVertically()
   pin.toSuperview()

    * `allEdges()`  
    Position 
    * `verticalEdges()`  
    Position 
    * `horizontalEdges()`  
    Position 

 - Percentages  (see https://github.com/freshOS/Stevia/blob/master/Source/Stevia%2BPercentage.swift)
    pin.top(5%)
    pin.left(20%)
    pin.bottom(10%)
    pin.right(15%)
    
 - Add parameter to sizeToFit indiquant si on doit caster ou pas le résultat
 
 - max/max height/width
    - minWidth(CGFloat)
    - minWidth(Percent)
    - maxWidth(CGFloat)
    - maxWidth(Percent)
    - minHeight(CGFloat)
    - minHeight(Percent)
    - maxHeight(CGFloat)
    - maxHeight(Percent)

 - Add size(_ width: CGFloat, _ height: CGFloat)
 - Add size(widthAndHeight: CGFloat)

 - [view3, view2, view1].stack(axis: .horizontal, spacing: 3)

 - frame(of: UIView)
 - frame()
  
 - In CSS
        - negative width and height is not applied, also for percentages
        - right/bottom: negative value and percentage is applyed 
                right: -20px  increase the width by an extra 20 pixels
                right: -50%   increase the width by an extra 50% (width = parent's width * 1.50)
        - negative margins affect the top, left, bottom, right. pixel or percent

 
 - sizeToFit() devrait prendre un parametre indiquant si on doit caster les nouvelles valeur
     de width et de height (forceSize, castSize, ...?)
 
 - dans le calcul des coordonné, ajouter un referenceView is superview then ...
    optimisation
 
 - maxWidth(), minWidth(), maxHeight(), minHeight()
 
 - Unit tests TODO:
    - pinTopLeft(to: Pin, of: UIView), topCenter(to: Pin, of: UIView), ...
    - margins and insets negatifs
    - margin(t: l: b: r:)

 - With SwiftyAttributes, you can write the same thing like this:

        let fancyString = "Hello World!".withTextColor(.blue).withUnderlineStyle(.styleSingle)
    Alternatively, SwiftyAttributes provides an Attribute enum:
        let fancyString = "Hello World!".withAttributes([
            .backgroundColor(.magenta),
            .strokeColor(.orange),
            .strokeWidth(1),
            .baselineOffset(5.2)
        ])
 
 - Inspired by https://github.com/robb/Cartography
     // Other possible syntax
    layout(viewA) { viewA in {
        viewA.pinTopLeft(to: viewB.pin.topLeft).margin(20)
        viewA.width(20).height(20)
    }
 
 //constrain(button1, button2) { button1, button2 in
 //    button1.right == button2.left - 12
 //}
*/