swiftsvprogresshud

SVProgressHUD issues in swift 3


Facing very rare issue in SVProgressHUD in Swift 3

Error of SVProgressHUD in Swift 3

Check the pod file i didn't do any thing wrong as mentioned on the SVProgressHUD on github.

SVProgressHUD POD file


Solution

  • the way you had written code is for objective-c use below code format in swift

    enter image description here

    import UIKit
        import SVProgressHUD
    
    class SubViewsViewController: UIViewController {
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            // Do any additional setup after loading the view.
    
            SVProgressHUD.show()
    
             Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(self.update), userInfo: nil, repeats: true)
    
      //With Dispatch Queue
        DispatchQueue.global(qos: .userInitiated).async {
            SVProgressHUD.show()
            // Bounce back to the main thread to update the UI
            DispatchQueue.main.async {
                Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(self.update), userInfo: nil, repeats: true)
            }
        }
    
    
        }
    
        func update() {
            SVProgressHUD.dismiss()
        }
    
    }