Delay when presenting new VC
IDontEatMeat opened this issue · 8 comments
There is a delay when presenting a new ViewController that contains the wheel, specifically when updateSlices() gets called. I tried calling updateSlices() in viewDidAppear and the wheel shows but the slices are not drawn yet. They appear after about 1 second.
Are you referencing to example project or your own?
Depending on what configuration parameters and how many slices you draw, there may be delays.
Additional information on how you draw the wheel and on which device causes delays can be helpful.
Hello,
Apologies for not explaining thoroughly. I am referencing my own project. I am creating the SwiftFortuneWheel programatically by giving it constraints, adding the prizes and calling updateSlices() in this order. The only difference between the example and my project is that i'm creating it programatically like so:
In viewDidLoad() I added
self.fortuneWheel = SwiftFortuneWheel(frame: .zero, slices: [], configuration: .exampleWithBlackCyanColorsConfiguration)
//Constraints follow
//Adding prizes
//updateSlices()
Running it on my iPhone X Max the actual device has a delay (haven't tried others). Regarding the number of slices i get the same delay for any number of slices which is strange. No matter I add 3 or 20 slices the delay is still there and it seems to be taking about the same amount of time.
Are you using the latest 0.8.1 version?
Is there any layout or other warnings in the debugger output window? Does your fortuneWheel layout in a 1:1 aspect ratio?
Did you try Example2 from the example project? Does it also cause delays?
I am using the latest version I have updated the pod about 2 hours ago. And yes there seems to be a warning i wasnt able to see it before because i had OS_ACTIVITY_MODE disabled. But here it is:
[Unknown process name] Error: this appliconati, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API and this value is being ignored. Please fix this problem.
I do use a 1:1 aspect ratio my constraints are:
self.fortuneWheel.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(self.fortuneWheel)
self.fortuneWheel.centerXAnchor.constraint(equalTo: self.view.centerXAnchor).isActive = true
self.fortuneWheel.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant:-60).isActive = true
self.fortuneWheel.widthAnchor.constraint(equalTo: self.view.widthAnchor, multiplier: 0.8).isActive = true
self.fortuneWheel.heightAnchor.constraint(equalTo: self.view.widthAnchor, multiplier: 0.8).isActive = true
Unfortunately, I can't reproduce this error.
I can only ask you to create a project with one viewController, to create everything that you do there and if the problem is also present there, please send the project to me, I will try to solve it.
Thanks for your time I will do that
Hello,
It seems to be working now. I have no clue what the issue was. Sorry for wasting your time
I found what the issue in case you were curious. I'm not sure if it might be helpful to you but just in case. The images i was setting for the AnchorImage were too large in size and thats why it was a delay because it was loading them.
Cheers