I am having troubles stopping an activity indicator from a function in my app delegate, i know the function is getting called but i do not recieve any errors in my log.
I am creating the activityIndicator in my signInViewController like so
@IBAction func googleSignInButton(_ sender: Any) {
GIDSignIn.sharedInstance().uiDelegate = self
GIDSignIn.sharedInstance().signIn()
activityIndicator.center = self.view.center
activityIndicator.hidesWhenStopped = true
activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.white
view.addSubview(activityIndicator)
activityIndicator.startAnimating()
UIApplication.shared.beginIgnoringInteractionEvents()
}
after this in my app delegate i have this function,
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error?) {
print("this function is running")
SignInViewController().stopanimating()
// ...
if error != nil {
// ...
return
}
I know this function is working fine as it prints the text in the log ect. and calls this function from the SignInViewController
func stopanimating() {
print("stop animating function running")
DispatchQueue.main.async {
self.activityIndicator.stopAnimating()
UIApplication.shared.endIgnoringInteractionEvents()
}
}
now i know this function is running as it also prints the expected text in the log and also the endIgnoringInteractionEvents does work but the activity indicator is still running
im quite new to swift but ive been having problems manipulating objects in viewcontrollers from my appdelegate before, is this possible?
Thanks in advance