Skip to content

Instantly share code, notes, and snippets.

@froggomad
Created July 10, 2021 03:29
Show Gist options
  • Save froggomad/96d2ba5a199b49c7432704af9e95463c to your computer and use it in GitHub Desktop.
Save froggomad/96d2ba5a199b49c7432704af9e95463c to your computer and use it in GitHub Desktop.
import UIKit
class ViewController: UIViewController {
lazy var blueView: ViewControllerView = {
let view = ViewControllerView(viewColor: .systemBlue)
return view
}()
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
presentAlert(title: "Hello", body: "World")
}
override func loadView() {
view = blueView
}
@objc private func presentAlert(title: String, body: String) {
let alertController = UIAlertController(title: title, message: body, preferredStyle: .alert)
let action = UIAlertAction(title: "Ok", style: .default)
alertController.addAction(action)
present(alertController, animated: true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment