I am trying to integrate the SVProgressHUD library and want to show before the API response on my controller for that I have written a code but it's throwing an error like Thread 1: "-[MYOWEB.AppDelegate window]: unrecognized selector sent to instance 0x600001bc2a40"
//ViewController.swift
import UIKit
import SVProgressHUD
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
SVProgressHUD.setDefaultMaskType(.clear)
SVProgressHUD.setDefaultStyle(.custom)
SVProgressHUD.setForegroundColor(UIColor.white)
SVProgressHUD.setBackgroundColor(#colorLiteral(red: 0.1333333333, green: 0.3764705882, blue: 0.9960784314, alpha: 1).withAlphaComponent(1))
}
}
My guess is that your AppDelegate.swift does not have a window property. i.e ‘let window; UIWindow’ The library depend on it see line 72 here https://github.com/SVProgressHUD/SVProgressHUD/blob/master/SVProgressHUD/SVProgressHUD.m
Look at the example demo app for more details https://github.com/SVProgressHUD/SVProgressHUD/blob/master/Demo/Classes/AppDelegate.h