     }
     
     public override func insertSubview(_ view: UIView, at index: Int) {
-        if index == subviews.count {
+        if index >= subviews.count || subviews.count == 0 {
             addSubview(view)
         }
         view.translatesAutoresizingMaskIntoConstraints = false
+        
+        let previous = index > 0 ? subviews[index - 1] : nil
+        
+        if direction == .vertical {
+            view.frame = CGRect(x: 0, y: previous?.frame.maxY ?? 0, width: 0, height: 0)
+        } else {
+            view.frame = CGRect(x: previous?.frame.maxX ?? 0, y: 0, width: 0, height: 0)
+        }
+        
         super.insertSubview(view, at: index)
         
         let insets = delegate?.stackedView(self, spacingForView: view) ?? UIEdgeInsets.zero
         
-        guard index > 0 else {
+        guard let previousView = previous else {
             let vConstraints = NSLayoutConstraint.constraints(
                 withVisualFormat: "\(vAxis):|-top-[addedView]",
                 options: NSLayoutFormatOptions(rawValue: 0),

            views: ["previousView": previousView,
                    "addedView": view]
        )
        self.addConstraints(constraints)
        
        let hConstraints = NSLayoutConstraint.constraints(

            return
        }
        
        let previousInsets = delegate?.stackedView(self, spacingForView: previousView) ?? UIEdgeInsets.zero
        
        let constraints = NSLayoutConstraint.constraints(
