SnoozerViewController.swift 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // LoopFollow
  2. // SnoozerViewController.swift
  3. // Created by Jonas Björkert.
  4. import Combine
  5. import SwiftUI
  6. import UIKit
  7. class SnoozerViewController: UIViewController {
  8. private var hostingController: UIHostingController<SnoozerView>?
  9. @State private var snoozeMinutes = 15
  10. override func viewDidLoad() {
  11. super.viewDidLoad()
  12. view.backgroundColor = .black
  13. let snoozerView = SnoozerView()
  14. let hosting = UIHostingController(rootView: snoozerView)
  15. hostingController = hosting
  16. addChild(hosting)
  17. view.addSubview(hosting.view)
  18. hosting.view.translatesAutoresizingMaskIntoConstraints = false
  19. NSLayoutConstraint.activate([
  20. hosting.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
  21. hosting.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
  22. hosting.view.topAnchor.constraint(equalTo: view.topAnchor),
  23. hosting.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
  24. ])
  25. hosting.didMove(toParent: self)
  26. }
  27. }