
import UIKit
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
showAlert()
}
private func showErrorAlert() {
let alert = UIAlertController(title: "Network Error",
message: "Please check your network connectivity and try again.",
preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
present(alert, animated: true, completion: nil)
}
}