 extension MarsImageViewController: UIPopoverPresentationControllerDelegate {
     
 }
+
+extension String {
+    func width(withConstrainedHeight height: CGFloat, font: UIFont) -> CGFloat {
+        let constraintRect = CGSize(width: .greatestFiniteMagnitude, height: height)
+        let boundingBox = self.boundingRect(with: constraintRect, options: .usesLineFragmentOrigin, attributes: [NSAttributedStringKey.font: font], context: nil)
+        return ceil(boundingBox.width)
+    }
+}

            return catalog!.marsphotos
        }
    }
    
    
}

extension Notification.Name {

    
    func setImageSelectionButtonWidth() {
        if let title = imageSelectionButton.title {
            imageSelectionButton.width = title.width(withConstrainedHeight: toolbar.frame.size.height, font: UIFont.systemFont(ofSize: 20))
        }
    }
    
