4 ms·
I’m achieving very custom looks in SwiftUI. What exactly do you find punishing?
by turnsout 2y ago
I’m achieving very custom looks in SwiftUI. What exactly do you find punishing?
- ChrisMarshallNY 2y agoHere's an example from a couple of weeks ago: I wrote a small SwiftUI app, to display simple bar charts of data from our social app. Number of active users, vs. ones that haven't signed in, user acceptance/rejection rates, etc. The SwiftUI Charts library is pretty good for this. I consume a CSV file into a dataframe, and add some extra computed properties, etc. I wanted to add the ability to pinch to zoom, so users don't need to look at the entire dataset, and try to find individual days, etc. I banged my head for a couple of days, getting it working the way I needed (TL;DR, I did. Just took a while). I can add a magnification gesture adornment, but the docs for it suck, the docs for the charts suck, the docs for the viewbuilder suck, the docs for the view suck, and even the docs for the dataframe suck. I basically had to find out what I needed, by trial and error, and examining the exposed protocols. Some of the stuff is crazy easy, like translating the pinch to a usable number, but then, I wanted to add a bit of custom handling, for the edges, and allowing the user to pan the chart, while also being able to individually inspect bars (I ended up giving up on that, and have an ugly scrubber scrollbar under the chart). It also doesn't work on the Mac, which sucks, because I do a lot of admin stuff on the Mac. It's a long story, and I'm sure that you would find fault with my work (one of the things geeks love to do, is point out errors made by other geeks), but it shipped, it works, and we've been using it for days. And, in the end, even though it exhibits nonstandard behavior, it looks exactly like a Settings App panel. That's fine. It's a backend dashboard, but I'd be upset if it was something we needed to expose to end-users of the app.