 
     public func start() {
         let alert = type.alertController(preferredStyle: preferredStyle)
+        if case .actionSheet(let source) = preferredStyle, let sourceView = source {
+            switch sourceView {
+            case .button(let button):
+                alert.popoverPresentationController?.barButtonItem = button
+            case .view(let view):
+                alert.popoverPresentationController?.sourceView = view
+            }
+        }
         parentViewController.present(alert, animated: animated, completion: nil)
         viewController = alert
     }

}

public extension DefaultCoordinator {
    public func showAlert(for error: Error, preferredStyle: UIAlertControllerStyle = .alert) {
        guard let viewController = self.viewController else {
            return
        }

import UIKit

public class AlertCoordinator: DefaultCoordinator {

    public enum Source {
        case button(UIBarButtonItem)
        case view(UIView)
    }

    public enum Style {
        case alert
        case actionSheet(source: Source?)

        var controllerStyle: UIAlertControllerStyle {
            switch self {
            case .alert:
                return .alert
            case .actionSheet:
                return .actionSheet
            }
        }
    }

    enum InputType {
        case error(Error)
        case custom(title: String?, message: String?, actions: [ErrorAction]?)

        func alertController(preferredStyle: Style = .alert) -> UIAlertController {
            switch self {
            case .error(let error):
                return UIAlertController(error: error, preferredStyle: preferredStyle.controllerStyle)
            case .custom(let title, let message, let actions):
                let alert = UIAlertController(title: title, message: message, preferredStyle: preferredStyle.controllerStyle)
                (actions ?? [ErrorAction(title: NSLocalizedString("OK", comment: "OK"))]).map { $0.alertAction() }.forEach(alert.addAction)
                return alert
            }
