import UIKit
class VolumeControlViewController: UIViewController {
let volumeLabel = UILabel()
let volumeSlider = UISlider()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground
volumeLabel.textAlignment = .center
volumeLabel.font = UIFont.systemFont(ofSize: 24)
volumeLabel.text = "Volume: 50"
volumeSlider.minimumValue = 0
volumeSlider.maximumValue = 100
volumeSlider.value = 50
// TODO: Add target for slider value change
volumeLabel.translatesAutoresizingMaskIntoConstraints = false
volumeSlider.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(volumeLabel)
view.addSubview(volumeSlider)
NSLayoutConstraint.activate([
volumeLabel.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 40),
volumeLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
volumeSlider.topAnchor.constraint(equalTo: volumeLabel.bottomAnchor, constant: 20),
volumeSlider.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 40),
volumeSlider.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -40)
])
}