Skip to content

Instantly share code, notes, and snippets.

@froggomad
Last active July 10, 2021 03:53
Show Gist options
  • Save froggomad/a594fe39f153a40fd75fc33a3a31f5c9 to your computer and use it in GitHub Desktop.
Save froggomad/a594fe39f153a40fd75fc33a3a31f5c9 to your computer and use it in GitHub Desktop.
import UIKit
class ViewController: UIViewController {
lazy var blueView: ViewControllerView = {
let view = ViewControllerView(viewColor: .systemBlue, target: self, selector: #selector(presentAlert))
return view
}()
override func loadView() {
view = blueView
}
@objc private func presentAlert() {
let alertController = UIAlertController(title: "Hello", message: "World", 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