-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathPopUpViewController.swift
More file actions
50 lines (39 loc) · 1.28 KB
/
PopUpViewController.swift
File metadata and controls
50 lines (39 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// PopUpViewController.swift
// RoutingExample
//
// Created by Cassius Pacheco on 7/3/20.
// Copyright © 2020 Cassius Pacheco. All rights reserved.
//
import UIKit
final class PopUpViewController: UIViewController {
private let viewModel: PopUpViewModelInterface
init(viewModel: PopUpViewModelInterface) {
self.viewModel = viewModel
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
print("👶 \(self) Created")
let dismissButton = DefaultButton(title: "Dismiss", target: self, selector: #selector(dismissButtonTouchUpInside))
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.text = viewModel.message
let vStack = UIStackView(arrangedSubviews: [label, dismissButton])
vStack.axis = .vertical
vStack.spacing = 8.0
view.addSubview(vStack)
vStack.layout.center(in: view)
}
@objc
private func dismissButtonTouchUpInside() {
viewModel.dismissButtonTouchUpInside()
}
deinit {
print("♻️ \(self) Deallocated")
}
}