 import SnapKit
 
 struct BorderView {
-    let top: UIView
-    let left: UIView
-    let right: UIView
-    let bottom: UIView
-    let width: CGFloat
+    let view = UIView()
+    let top = UIView()
+    let left = UIView()
+    let right = UIView()
+    let bottom = UIView()
+    var width: CGFloat
     
     init(width: CGFloat = 2) {
-        top = UIView()
-        left = UIView()
-        right = UIView()
-        bottom = UIView()
         self.width = width
         
+        view.translatesAutoresizingMaskIntoConstraints = false
         top.translatesAutoresizingMaskIntoConstraints = false
         left.translatesAutoresizingMaskIntoConstraints = false
         right.translatesAutoresizingMaskIntoConstraints = false
         bottom.translatesAutoresizingMaskIntoConstraints = false
     }
     
-    func layoutTop(_ superView: UIView) {
-        superView.addSubview(top);
+    func addTopBorder() {
+        view.addSubview(top);
         top.snp.makeConstraints { (make) in
             make.top.equalToSuperview()
             make.left.equalToSuperview()


@objc(PVIHomeView)
public class PVIHomeView: UIView {
    let before: UIView = UIView()
    let beforeBorder: BorderView = BorderView()
    let main: UIView = UIView()
    let mainBorder: BorderView = BorderView()
    let after: UIView = UIView()
    let afterBorder: BorderView = BorderView(width: 1)
    
    
    required public init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder);
        
        // before
        self.addSubview(before)
        beforeBorder.layoutTop(before)
        beforeBorder.layoutLeft(before)
        
        before.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.centerY.equalToSuperview()
            make.width.equalToSuperview().multipliedBy(22 / 34.0)
            make.height.equalToSuperview().multipliedBy(22 / 34.0)
        }
        before.transform = CGAffineTransform(rotationAngle: CGFloat(M_PI_4))
        
        // main
        self.addSubview(main)
        mainBorder.layoutLeft(main)
        mainBorder.layoutRight(main)
        mainBorder.layoutBottom(main)
        
        main.translatesAutoresizingMaskIntoConstraints = false
        main.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.centerY.equalToSuperview().multipliedBy(1 + 12 / 34.0)
            make.width.equalToSuperview().multipliedBy(22 / 34.0)

        }
    }
    
    func addRightBorder() {
        view.addSubview(right);
        right.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.right.equalToSuperview()
