                 closeButton.rightAnchor.constraint(equalTo: view.rightAnchor, constant: 0.0),
                 closeButton.heightAnchor.constraint(equalToConstant: 52.0),
                 closeButton.widthAnchor.constraint(equalToConstant: 52.0),
+                ].forEach { $0.isActive = true }
+            
+        }
+    }
+    
+    func layoutShareButton() {
+        shareButton.translatesAutoresizingMaskIntoConstraints = false
+        if #available(iOS 11.0, *) {
+            [
+                shareButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 0.0),
+                shareButton.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor, constant: 0.0),
+                shareButton.heightAnchor.constraint(equalToConstant: 52.0),
+                shareButton.widthAnchor.constraint(equalToConstant: 52.0),
+                ].forEach { $0.isActive = true }
+        } else {
+            [
+                shareButton.topAnchor.constraint(equalTo: view.topAnchor, constant: 0.0),
+                shareButton.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0.0),
+                shareButton.heightAnchor.constraint(equalToConstant: 52.0),
+                shareButton.widthAnchor.constraint(equalToConstant: 52.0),
                 ].forEach { $0.isActive = true }
             
         }

    public weak var delegate: PhotoSliderDelegate?
    public var visiblePageControl = true
    public var visibleCloseButton = true
    public var currentPage = 0
    public var captionNumberOfLines = 3
    public var openableActivityController = false

            layoutCloseButton()
        }
        
        if visibleShareButton {
            view.addSubview(shareButton)
            layoutShareButton()
        }
        
        // Caption Background
        view.addSubview(captionBackgroundView)
        
