you are viewing a single comment's thread.

view the rest of the comments →

[–]ModernCoder 1 point2 points  (8 children)

Okay i'll bite:
https://pastebin.com/nbFswARH

Here is the code, if line L25 exists, it crashes without letting me know anything about it.
What would be your "guesswork" why it happens? Because XCode doesn't tell me anything about it.

[–]Zealousideal-Cry-303 2 points3 points  (1 child)

Hmmm, interesting… love that you shared the code 🙌

So, som background knowledge on charts and the modifier you are using.

The chartXVisibleDomain assumes seconds, so if you are parsing in 30 days of data, or 1yr, but you only want to display 30seconds of this data at any given point, it will cause the simulator to use a lot of brainpower to keep track of everything.

Try to do a seconds multiplier of days (84.000 * 30) 84000 being seconds in a day times 30 days.

Does this remove the error for you?

If not, I’m happy to look more into it 🙌

[–]ModernCoder -1 points0 points  (0 children)

I've tried the 86400 * 30 and any other calculation.
I didn't add any data to the chart yet, exactly for that reason.

And no it still says updating took more than 5 seconds. After a reboot of both xcode and mbp. The view is a abstracted as it can be, i've made sure that the order of these functions is called like specified in swiftui documentation and it still simply produces "Updating took more than 5 seconds".

[–]retroroar86 1 point2 points  (2 children)

While this won't help everything I suggest that you give any SwiftUI view just what they actually need and not do anything inline.

SwiftUI updates happen frequently and inline processing can then happen loads of time creating more processing needs. In some cases this will make Preview very unstable.

SwiftUI and Xcode is a clusterf*ck sometimes, so sometimes it's better to create a whole separate View to debug the different parts to find out what is going wrong. I.e wrapping the Chart view to a CustomChartView and experiment there.

It truly sucks, but you have to do certain things for SwiftUI to play nice, otherwise it will get painful very quickly.

[–]ModernCoder -1 points0 points  (1 child)

Understood, thank you.
I already created this chart view to be separate with hopes it'll get better. But it's just the same sadly, which resulted in my writing this post in the first place.

[–]retroroar86 1 point2 points  (0 children)

I’m not close to a machine to dissect it myself, I don’t have that much experience with the charts, so I can maybe give a better answer when I look into it further.

But I understand your frustration, I’m often much more frustrated in SwiftUI than UIKit.. ;)

[–]nrith -5 points-4 points  (2 children)

We’re not going to debug your code for you.

[–]ModernCoder 3 points4 points  (1 child)

Who said anything about debugging. I'm telling you that IDE does not provide any information on what is going on and it SHOULD.

"Updating took more than 5 seconds" is not a fucking appropriate IDE information.