diff --git a/Tusker/Screens/Large Image/LargeImageViewController.swift b/Tusker/Screens/Large Image/LargeImageViewController.swift index e8ad7956..ee047492 100644 --- a/Tusker/Screens/Large Image/LargeImageViewController.swift +++ b/Tusker/Screens/Large Image/LargeImageViewController.swift @@ -25,9 +25,9 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate { @IBOutlet weak var topControlsView: UIView! @IBOutlet weak var topControlsHeightConstraint: NSLayoutConstraint! - @IBOutlet weak var downloadButton: UIButton! - @IBOutlet weak var downloadButtonTopConstraint: NSLayoutConstraint! - @IBOutlet weak var downloadButtonLeadingConstraint: NSLayoutConstraint! + @IBOutlet weak var shareButton: UIButton! + @IBOutlet weak var shareButtonTopConstraint: NSLayoutConstraint! + @IBOutlet weak var shareButtonLeadingConstraint: NSLayoutConstraint! @IBOutlet weak var closeButton: UIButton! @IBOutlet weak var closeButtonTopConstraint: NSLayoutConstraint! @IBOutlet weak var closeButtonTrailingConstraint: NSLayoutConstraint! @@ -136,8 +136,8 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate { // running on iPhone X style notched device let notchWidth: CGFloat = 209 let earWidth = (view.bounds.width - notchWidth) / 2 - let offset = (earWidth - downloadButton.bounds.width) / 2 - downloadButtonLeadingConstraint.constant = offset + let offset = (earWidth - shareButton.bounds.width) / 2 + shareButtonLeadingConstraint.constant = offset closeButtonTrailingConstraint.constant = offset } } @@ -221,19 +221,10 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate { dismiss(animated: true) } - @IBAction func downloadPressed(_ sender: Any) { + @IBAction func sharePressed(_ sender: Any) { guard let image = image else { return } - PHPhotoLibrary.shared().performChanges({ - PHAssetChangeRequest.creationRequestForAsset(from: image) - }, completionHandler: { success, error in - if success { - return - } else if let error = error { - print("Couldn't save photo: \(error)") - } else { - return - } - }) + let activityVC = UIActivityViewController(activityItems: [image], applicationActivities: nil) + present(activityVC, animated: true) } } diff --git a/Tusker/Screens/Large Image/LargeImageViewController.xib b/Tusker/Screens/Large Image/LargeImageViewController.xib index abd1d9d1..81367085 100644 --- a/Tusker/Screens/Large Image/LargeImageViewController.xib +++ b/Tusker/Screens/Large Image/LargeImageViewController.xib @@ -1,10 +1,8 @@ - - - - + + - + @@ -16,15 +14,15 @@ - - - + + + @@ -61,9 +59,9 @@ - + - +