         return superlayout == nil
     }
     
-    public private(set) var frame: CGRect = .zero {
-        didSet {
-            view?.frame = frame
-        }
-    }
+    public private(set) var frame: CGRect = .zero
     
     public var intrinsicSize: CGSize {
-        return calculate(with: .undefined)
+        _calculateNode(.undefined)
+        return CGSize(width: node.layoutWidth, height: node.layoutHeight)
     }
     
     internal init(view: UIView? = nil) {

            
            sublayouts.forEach {
                if isView {
                    $0.applyToViews(preserveOrigin: preserveOrigin, offset: .zero)
                } else {
                    $0.applyToViews(preserveOrigin: preserveOrigin, offset: frame.origin)
                }
            }
        }
    }

    public func apply(preserveOrigin: Bool = false, dimensionFlexibility: YGDimensionFlexibility = [], _ callback: ((YGLayout) -> Void)? = nil) {
        var size = view?.frame.size.ygSize ?? .undefined
        
        if dimensionFlexibility.contains(.flexibleWidth) {
            size.width = YGValueUndefined.value
        }
        if dimensionFlexibility.contains(.flexibleHeigth) {
            size.height = YGValueUndefined.value
        }
        
        node.calculateLayout(size: size, direction: direction)
        
        applyToViews(preserveOrigin: preserveOrigin)
        
        callback?(self)
    }
    
}

        YGNodeFree(node)
    }
    
    
    public func calculate(constrainedSize: CGSize? = nil, preserveOrigin: Bool = false) {
        _calculateNode(constrainedSize)
        _calculateFrame(preserveOrigin: preserveOrigin, offset: .zero)
    }
    
    public func apply() {
        view?.frame = frame
        sublayouts.forEach {
            $0.apply()
        }
    }
    
    public func layout(preserveOrigin: Bool = false) {
        calculate(preserveOrigin: preserveOrigin)
        apply()
    }
    
    fileprivate func _calculateNode(_ size: CGSize? = nil) {
        let constrainedSize = size ?? view?.frame.size ?? .undefined
        node.calculateLayout(size: constrainedSize.ygSize, direction: direction)
    }
    
    fileprivate func _calculateFrame(preserveOrigin: Bool = false, offset: CGPoint = .zero) {
        if isEnabled {
            let origin = preserveOrigin ? frame.origin : .zero
            let topLeft = CGPoint(x: node.layoutLeft + offset.x, y: node.layoutTop + offset.y)
