4 ms·
Been writing an macOS app from scratch in SwiftUI (VM manager) and I can echo much of these concerns. Especially the random crashes and performance. Some other
by osy 6y ago
Been writing an macOS app from scratch in SwiftUI (VM manager) and I can echo much of these concerns. Especially the random crashes and performance. Some other random issues I’ve ran into:
* Different Betas changing the layout and style and meaning of different attributes. The change isn’t so bad as the documentation. Most of the functionality is sparely documented so it’s impossible to tell if something “broke” or was “fixed” in a new beta. Stuff like .overlay() vs ZStack and how they appear. Stuff like how .padding() is calculated with the default args. Stuff like what the default list modifier does.
* Last beta forgot to ship some symbols in SwiftUI.framework and .toolbar (a modifier to draw a toolbar) was missing. The fact that it slipped notice and nobody talked about makes me suspect nobody is actually using it.
* Common functionality like creating a new window with a different layout is missing. In fact it seems to revolve iOS where new window means same view in a new window.
* Weird quirks like if you dismiss a modal sheet before falling a background task would cause layout issues and random state changes. But if you dismiss the sheet after calling GCD it doesn’t happen. It’s likely a race condition somewhere. Another example https://stackoverflow.com/questions/58404725/why-does-my-swiftui-app-crash-when-navigating-backwards-after-placing-a-navigat/58466670#58466670 https://stackoverflow.com/questions/58404725/why-does-my-swi...
* Missing components like the activity indicator and the new settings tab design for TabView
* You either have no control over the layout or so much control it overwhelms you. For example if you wrap a View with Form it generates a right justified label and left justified field. It works for checkboxes and pickers but it doesn’t work for every component. If you want the same alignment for everything you have to throw away the work done by Form and completely define your own layout rules for everything.
* If you look up how to do anything, the “accepted” answer always feels hacked together and nobody can explain why it works. For example, if you look up how to force center alignment on any object there’s a blog post that’s about 20 pages that propose some solution that’s 200 LOC.
* Day to day, I feel very limited by the framework. At almost every point, I had to compromise the design vision with “what’s possible” in SwiftUI. And note this is a very “simple” app that manages VMs and allows you to change settings. Everything uses basic controls and there’s nothing exotic.
All this aside I still enjoyed using SwiftUI on most days. When it works, it feels like the future. Unfortunately v1/v2 is still very early and it’s filled with bugs. But people need to use it to find and report the bugs. I hope, like Swift, we’ll eventually be at a point where everyone uses it because it’s an upgrade from the previous technology without any compromises.
- saagarjha 6y agoI suspect many of the cases where things are not documented as to what they'll produce or how the layout will look are intentional, as SwiftUI seems to have the (somewhat idealistic) goal of "looking right" and not only does it have to infer intent from what you've written it also needs to be flexible enough to adapt to Apple's design roadmap for the future. So there's no documentation, not only because there are so many special case quirks they've added to support layouts that are considered "best practice design" in UIKit that nobody can really keep up or discover, but also because if they tie something down too much they won't be able to change it to a new design or paradigm. I suspect that they really want for 2022 to roll around and be able to come out on the stage at a WWDC and say that all apps using SwiftUI already get support on their new AR headset, and all standard controls have been mapped to analogues on that platform. If you document NavigationView as being a vibrant view on the top with a large title and a scroll view under it, you can't do this. Many of the bugs probably have more to do with the unshippability of macOS at the moment.