|
|
@@ -0,0 +1,55 @@
|
|
|
+//
|
|
|
+// OnboardingViewController.swift
|
|
|
+// CoordinatorSUIExamples
|
|
|
+//
|
|
|
+// Created by Pavel Yurchenko on 05.12.2024.
|
|
|
+//
|
|
|
+
|
|
|
+import UIKit
|
|
|
+
|
|
|
+final class OnboardingViewController: UIViewController {
|
|
|
+
|
|
|
+ var viewModel: OnboardingVM!
|
|
|
+
|
|
|
+ // MARK: - Outlets
|
|
|
+
|
|
|
+ private lazy var titleLabel = UILabel()
|
|
|
+
|
|
|
+ private lazy var messageLabel = UILabel()
|
|
|
+
|
|
|
+ private lazy var closeButton = UIButton(type: .system)
|
|
|
+
|
|
|
+ private lazy var stackView = UIStackView(arrangedSubviews: [titleLabel, messageLabel, closeButton])
|
|
|
+
|
|
|
+ // MRK: - Lifecycle
|
|
|
+
|
|
|
+ override func viewDidLoad() {
|
|
|
+ super.viewDidLoad()
|
|
|
+ setupUI()
|
|
|
+ setupLayout()
|
|
|
+ }
|
|
|
+
|
|
|
+ // MARK: - Private methods
|
|
|
+
|
|
|
+ @objc
|
|
|
+ private func onCloseButton() {
|
|
|
+ viewModel.output.onClose?()
|
|
|
+ }
|
|
|
+
|
|
|
+ private func setupUI() {
|
|
|
+ view.addSubview(stackView)
|
|
|
+
|
|
|
+ titleLabel.text = viewModel.title
|
|
|
+ messageLabel.text = viewModel.message
|
|
|
+ closeButton.setTitle(viewModel.closeButtonTitle, for: .normal)
|
|
|
+ closeButton.addTarget(self, action: #selector(onCloseButton), for: .touchUpInside)
|
|
|
+
|
|
|
+ stackView.axis = .vertical
|
|
|
+ }
|
|
|
+
|
|
|
+ private func setupLayout() {
|
|
|
+ stackView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ stackView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
|
|
|
+ stackView.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
|
|
|
+ }
|
|
|
+}
|