         return defaultLayoutModes
     }
     private var element: BayaLayoutable
-    private var measure: CGSize?
     private let referenceSide: BayaLayoutOptions.Orientation?
 
     init(

// MARK: Square shortcuts.

public extension BayaLayoutable {
    func layoutAsSquare(
        referenceSide: BayaLayoutOptions.Orientation)
            -> BayaSquareLayout {
        return BayaSquareLayout(
            element: self,

    }

    mutating public func layoutWith(frame: CGRect) {
        element.layoutWith(frame: CGRect(
            origin: frame.origin,
            size: squareSizeBasedOnReferenceSide(frame.size)))
    }

    public mutating func sizeThatFits(_ size: CGSize) -> CGSize {
        let adjustedSize = squareSizeBasedOnReferenceSide(size)
        let _ = element.sizeThatFits(adjustedSize)
        return adjustedSize
    }

    private func squareSizeBasedOnReferenceSide(_ size: CGSize) -> CGSize {
        switch referenceSide {
        case .some(.horizontal):
            return size.toSquareFromWidth()
        case .some(.vertical):
            return size.toSquareFromHeight()
        case .none:
            return size.toSquare()
        }
    }
}

