Рассмотрите возможность добавления UIImageView
в качестве подпредставления вашего корневого представления:
// Creating UIImageView, which holds an image
let imageView = UIImageView()
imageView.image = UIImage(named: "GasBackground.png")
imageView.contentMode = .scaleAspectFill
// Adding the image view to the view hierarchy
view.addSubview(imageView)
// Make image view to fit entire screen
imageView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
imageView.topAnchor.constraint(equalTo: view.topAnchor),
imageView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
imageView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
imageView.trailingAnchor.constraint(equalTo: view.trailingAnchor)
])