tomvorti.blogg.se

App candybar
App candybar













app candybar

The biggest surprise for me was how much trouble I had implementing the paging view to swipe left and right between wallpaper variants.1. In UIKit it’s trivial to enable paged mode on a UIScrollView to get this behavior, but I couldn’t find a way to do it in SwiftUI for some reason. Did I really need to do all of this myself from scratch? I ran across a bunch of tutorials that were manually implementing panning gestures and paging and I was flabbergasted.

app candybar app candybar app candybar

I tried a few different open source paging view implementations I found on GitHub but they were all lacking in one way or another. The most glaring problem with them tended to be that the scrolling physics felt entirely wrong. The swipes didn’t have the same momentum that Apple uses everywhere else and the resistance on the rubber band effect (if it even had it) was never quite right. I started going down the road of adapting one of the better ones with more correct physics after I discovered this gem of a project which meticulously deconstructed the formulas necessary to get an Apple-like scroll view feeling. I was pretty far into this when I accidentally stumbled across a Stack Overflow comment noting that SwiftUI actually does have a native paging view – it’s just cleverly hidden as a TabView style! srsly? Still, though, nothing about this approach felt right.Įventually I decided that maybe I should just wrap a UIScrollView to accomplish what we needed and started to dive into that. I wasted most of a week on approaches to this before I managed to discover that, lo and behold, SwiftUI actually does have a way to do it – and it’s a single line of code. I was supremely pissed off at myself for somehow missing this. I suppose perhaps my search terms were too laced with an assumption that it’d be a part of ScrollView somehow or that it would exist as its own view? Despite all of my searching, I never managed to notice any reference to it in the documentation and apparently didn’t remember anything about it from any of the WWDC videos I had watched, either. I soon learned that SwiftUI didn’t always include support for a paging view – which is why there were so many outdated tutorials and open source projects out there for me to accidentally find instead of the official API. (This is also true of Swift itself – although it’s getting better over time as they’ve become more resistant to source breaking changes.) SwiftUI changes so much every year and I can’t count the number of times I found an accepted Stack Overflow answer for a thing that was completely wrong as a result. There’s also something off about how SwiftUI documentation is written and organized. It frequently feels next to impossible to find the name of whatever view modifier you might be needing unless you more or less already know what you’re looking for. To make matters worse, the fact that SwiftUI’s view modifiers almost all exist as function extensions on View means just pressing the period key and browsing autocompletion suggestions tells you nothing about what might or might not make sense to use in your current context. The plethora of tutorials, Medium articles, YouTube videos, and books also mostly have a feeling of “magical thinking” to them – as if you just need to memorize incantations to spells rather than learn any of the actual science behind the effects you are trying to achieve. I find that aspect of the SwiftUI ecosystem extremely frustrating and disappointing.Īll together these things make SwiftUI feel very difficult to learn and master. So anyway, after discovering TabView‘s support for paging, I threw away everything I had been working on for a week and used it instead.

APP CANDYBAR SERIES

My source file has 6 different bullet points of issues I ran into! I don’t want to get in to every single problem I ran into with it or this blog series would be about three times longer than it is already, but suffice to say there were a lot.















App candybar