// // LoaderViewController.swift // VDS // // Created by Matt Bruce on 7/5/23. // import Foundation import UIKit import VDSColorTokens public class LoaderViewController: UIViewController, Surfaceable { private var loader = Loader() private var backgroundColorConfiguration = SurfaceColorConfiguration(VDSColor.backgroundPrimaryLight, VDSColor.backgroundPrimaryDark) public var surface: Surface = .light public var size: Int? public override func viewDidLoad() { super.viewDidLoad() setup() } public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) updateView() } open func updateView() { view.backgroundColor = backgroundColorConfiguration.getColor(self).withAlphaComponent(0.8) if let size { loader.size = size } loader.surface = surface } private func setup() { view.addSubview(loader) NSLayoutConstraint.activate([ loader.centerXAnchor.constraint(equalTo: view.centerXAnchor), loader.centerYAnchor.constraint(equalTo: view.centerYAnchor) ]) } }