     
     open func constrainCenterXToSuperview() {
         if let superview = superview {
-            constrainXCenter(to:superview)
+            constrainCenterX(to:superview)
         }
     }
     
     open func constrainCenterYToSuperview() {
         if let superview = superview {
-            constrainYCenter(to:superview)
+            constrainCenterY(to:superview)
         }
     }
     

        self.removeConstraints(self.constraints)
    }

    open func constrainXCenter(to:UIView) {
        self.translatesAutoresizingMaskIntoConstraints=false
        self.centerXAnchor.constraint(equalTo: to.centerXAnchor).isActive = true
    }
    
    open func constrainYCenter(to:UIView) {
        self.translatesAutoresizingMaskIntoConstraints=false
        self.centerYAnchor.constraint(equalTo: to.centerYAnchor).isActive = true
    }
    
    open func constrainCenter(to:UIView) {
        self.constrainXCenter(to: to)
        self.constrainYCenter(to: to)
    }
    
    open func constrainCenterToSuperview() {

    
    open func removeAllSubviews() {
        self.subviews.forEach { $0.removeFromSuperview() }
    }
    
    open func subview(withTag:Int) -> UIView? {
        var result:UIView?
        if let index = self.subviews.index(where: {
            $0.tag == withTag
        }) {
            result = self.subviews[index]
        }
        return result
    }
    
    open func removeSubview(withTag:Int) {
        if let result = subview(withTag: withTag) {
            result.removeFromSuperview()
        }
    }
}

