Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work on viewDidLoad #13

Open
chapuyj opened this issue May 8, 2015 · 5 comments
Open

Doesn't work on viewDidLoad #13

chapuyj opened this issue May 8, 2015 · 5 comments

Comments

@chapuyj
Copy link

chapuyj commented May 8, 2015

Hi !

I've tried to add your nice spinner on my project, and, to do a first test, I've just call "show" method on the "viewDidLoad" of my first controller... But nothing was shown.

Then, I've tried to put it on "viewDidAppear" and it was OK.

Is it normal ?

@akiokio
Copy link

akiokio commented Sep 3, 2015

+1

I'm guessing here but maybe because of this line?
let window = UIApplication.sharedApplication().windows.first as! UIWindow

maybe in the viewDidLoad method the window is nil?

@martheli
Copy link

martheli commented Jul 9, 2017

Has anyone found a work around for this? Id like to be able to start animating from the viewDidLoad.

@icanzilb
Copy link
Owner

icanzilb commented Jul 9, 2017

the comment above is correct - at view did load the controller is not in the app view hierarchy and therefore has no window. you should show the spinner in your viewWillAppear(_:) method

@martheli
Copy link

I put the show spinner in the viewWillAppear and then the stop spinner at the end of my viewDidLoad but for some reason the animation only works for maybe 2 seconds then stops animating. The spinner still shows and then closes once the viewDidLoad alamofire request completes but it just doesn't animate for the entire time.

@DavidLari
Copy link
Contributor

Perhaps you have some code blocking the UI thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants