// // LoaderLaunchable.swift // VDS // // Created by Matt Bruce on 7/5/23. // import Foundation import UIKit public protocol LoaderLaunchable { func presentLoader(surface: Surface, size: Int?) func dismissLoader() } extension LoaderLaunchable { public func presentLoader(surface: Surface, size: Int? = nil) { if let presenting = UIApplication.topViewController() { let viewController = LoaderViewController(nibName: nil, bundle: nil).with { $0.surface = surface if let size { $0.size = size } $0.modalPresentationStyle = .overFullScreen $0.modalTransitionStyle = .crossDissolve } presenting.present(viewController, animated: true) } } public func dismissLoader() { if let presenting = UIApplication.topViewController() as? LoaderViewController { presenting.dismiss(animated: true) } } }