in the simple language: can we create that alert Box as a reusable method

i want to made 1 Alert box in to the function. like this.
// this code has separate file 
import UIKit
struct AlertView {
    public func showAlertBox(title: String, message: String) -> UIAlertController {
         let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
         alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: { _ in
       }))
    return alert
  }
}
and here is my caller ViewController file code.
 @IBAction func submitPressed(_ sender: Any) {
     let alertView = AlertView()
     let alert = alertView.showAlertBox(title: "Hours Added", message: "Hours have been updated")
     alert.present(alert, animated: true) {
         self?.dismiss(animated: true, completion: nil)
         self?.timeSubmitted = true
         self?.performSegue(withIdentifier: "unwindToMyHours", sender: nil)
     }
 }
 
     
     
    