У меня есть одна проблема, когда я вижу, что мой вид представлен черным цветом BG.Вот мой код:
class Loader: UIViewController, NVActivityIndicatorViewable {
override func viewDidLoad() {
super.viewDidLoad()
self.modalPresentationStyle = .currentContext
self.view.backgroundColor = .clear
self.view.isOpaque = false
let width = UIScreen.main.bounds.width
let height = UIScreen.main.bounds.height
let frame = CGRect(x: width / 2, y: height / 2, width: 100, height: 100)
let activityIndicatorView = NVActivityIndicatorView(frame: frame, type: NVActivityIndicatorType.lineScale, color: GlobalVariables.stacksBlue, padding: 20)
self.view.addSubview(activityIndicatorView)
activityIndicatorView.startAnimating()
activityIndicatorView.translatesAutoresizingMaskIntoConstraints = false
activityIndicatorView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
activityIndicatorView.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
}
И добавочный номер, где находится функция вызова:
extension UIViewController {
func showLoader() {
let loader = Loader()
self.modalPresentationStyle = .currentContext
self.present(loader, animated: false, completion: nil)
}
func hideLoader() {
self.dismiss(animated: false, completion: nil)
}
}