import UIKit class ModalViewController: UIViewController { let navBar = SPFakeBarView(style: .stork) var lightStatusBar: Bool = false override var preferredStatusBarStyle: UIStatusBarStyle { return self.lightStatusBar ? .lightContent : .default } override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = UIColor.white self.modalPresentationCapturesStatusBarAppearance = true self.navBar.titleLabel.text = "View" self.navBar.leftButton.setTitle("Cancel", for: .normal) self.navBar.leftButton.addTarget(self, action: #selector(self.dismissAction), for: .touchUpInside) self.view.addSubview(self.navBar) } @objc func dismissAction() { SPStorkController.dismissWithConfirmation(controller: self, completion: nil) } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.lightStatusBar = true UIView.animate(withDuration: 0.3) { () -> Void in self.setNeedsStatusBarAppearanceUpdate() } } } extension ModalViewController: SPStorkControllerConfirmDelegate { var needConfirm: Bool { return false } func confirm(_ completion: @escaping (Bool) -> ()) { var style: UIAlertController.Style = .actionSheet if UIDevice.current.userInterfaceIdiom != .phone { style = .alert } let alertController = UIAlertController(title: "Need dismiss?", message: "It test confirm option for SPStorkController", preferredStyle: style) alertController.addDestructiveAction(title: "Confirm", complection: { completion(true) }) alertController.addCancelAction(title: "Cancel") { completion(false) } self.present(alertController) } }