     private var xEndingPoint: CGFloat = 0
     private var buttonHeight: CGFloat = 0
     private var isFinished: Bool = false
-    private var layoutSetuped: Bool = false
-    override init(frame: CGRect) {
+    
+    override public init(frame: CGRect) {
         super.init(frame: frame)
         setupView()
     }
     private var panGestureRecognizer: UIPanGestureRecognizer!
     
-    required init?(coder aDecoder: NSCoder) {
+    required public init?(coder aDecoder: NSCoder) {
         super.init(coder: aDecoder)!
         setupView()
     }

        }
    }
    // MARK: Default styles
    var sliderCornerRadious: CGFloat = 30.0 {
        didSet {
            sliderHolderView.layer.cornerRadius = sliderCornerRadious
            draggedView.layer.cornerRadius = sliderCornerRadious
        }
    }
    var disableThumbnailViewColor: UIColor = UIColor(red:182.0/255, green:192.0/255, blue:202.0/255, alpha:1) {
        didSet {
            if !isEnabled {
                thumnailImageView.backgroundColor = disableThumbnailViewColor
            }
        }
    }
    var disableSliderViewColor: UIColor = UIColor(red:245.0/255, green:247.0/255, blue:250.0/255, alpha:1) {
        didSet {
            if !isEnabled {
                sliderHolderView.backgroundColor = disableSliderViewColor
            }
        }
    }
    var defaultSliderBackgroundColor: UIColor = UIColor(red:0.1, green:0.61, blue:0.84, alpha:0.1) {
        didSet {
            sliderHolderView.backgroundColor = defaultSliderBackgroundColor
        }
    }
    
    var defaultSlidingColor:UIColor = UIColor(red:25.0/255, green:155.0/255, blue:215.0/255, alpha:0.7) {
        didSet {
            draggedView.backgroundColor = defaultSlidingColor
        }
    }
    var defaultThumbnailColor:UIColor = UIColor(red:25.0/255, green:155.0/255, blue:215.0/255, alpha:1) {
        didSet {
            thumnailImageView.backgroundColor = defaultSlidingColor
        }
    }
    var defaultLabelText: String = "Swipe to open" {
        didSet {
            textLabel.text = defaultLabelText
        }


import UIKit

@objc public protocol MTSlideToOpenDelegate {
    func mtSlideToOpenDelegateDidFinish(_ sender: MTSlideToOpenView)
}

public class MTSlideToOpenView: UIView {
    // MARK: All Views
    public let textLabel: UILabel = {
        let label = UILabel.init()
        return label
    }()
    public let thumnailImageView: UIImageView = {
        let view = MTRoundImageView()
        view.isUserInteractionEnabled = true        
        view.contentMode = .center
        return view
    }()
    public let sliderHolderView: UIView = {
        let view = UIView()
        return view
    }()
    public let draggedView: UIView = {
        let view = UIView()
        return view
    }()
    public let view: UIView = {
        let view = UIView()
        return view
    }()
    // MARK: Public properties
    public weak var delegate: MTSlideToOpenDelegate?
    public var animationVelocity: Double = 0.2
    public var sliderViewTopDistance: CGFloat = 8.0 {
        didSet {
            topSliderConstraint?.constant = sliderViewTopDistance
            layoutIfNeeded()
        }
    }
    public var thumbnailViewLeadingDistance: CGFloat = 0.0 {
        didSet {
            updateThumbnailViewLeadingPosition(thumbnailViewLeadingDistance)
            layoutIfNeeded()
        }
    }
    public var textLabelLeadingDistance: CGFloat = 0 {
        didSet {
            leadingTextLabelConstraint?.constant = textLabelLeadingDistance
            layoutIfNeeded()
        }
    }
    public var isEnabled:Bool = true {
        didSet {
            if isEnabled {
                thumnailImageView.backgroundColor = defaultThumbnailColor
