Live data from Hacker News

Why I quit using SwiftUI

chsxf.dev

31–40 of 257 posts

Re: Why I quit using SwiftUI

#31
post #4
post #2

SwiftUI is a big opportunity that Apple's not investing enough in, IMHO. It's good tech, and the reactive approach is excellent for many typical view-based needs, but at the same time the docs are terribly lacking at how to handle any kind of edge cases. Success to me looks like steering clear of SwiftUI for now, and advocating for Apple to hire documentation editors/leaders who can 1) create SwiftUI documentation of…

It's a great idea but not fully baked yet. My former colleague is using it for internal apps and it seems to work fairly well (UI is not fancy), but not for anything going into the high volume apps, which has much more complex behavior (designers are asking for stupidly complex UI). It's much better in the upcoming OS since they added better navigation, but requires the latest OS, which is not supportive for many com…

At my company we've been slowly rewriting our UIKit app in SwiftUI. We were due for a rewrite when SwiftUI dropped. I'd say we're about 75% done.

For those "stupidly complex UIs", SwiftUI just doesn't have enough hooks for customization. And the improvements are too slow. Using SwiftUI has been bitter-sweet. It feels like you just can't use it to craft a high quality app that doesn't look like a generic iOS app.

Re: Why I quit using SwiftUI

#32

People burn an astounding amount of CPU and brain cycles pretending that UIs are something they are not. (i.e. "pure" functions) I hope Apple never goes the way Microsoft did with their fad UI toolkits that utterly destroyed developer trust in native Windows development (MFC, WinForms, WPF, UWP, WinUI, .Net MAUI). They are pretty wise for keeping SwiftUI be the "for kids" vanity UI toolkit to lure in React webdevs, w…

> They are pretty wise for keeping SwiftUI be the "for kids" vanity UI toolkit to lure in React webdevs, while keeping UIKit and AppKit for serious stuff. At WWDC 2022 they specifically said that Swift+SwiftUI is the best way to build apps, and the future of their platforms. I thought AppKit/UIKit would stick around, but I guess not. --------------------------- Edit: Here's the direct quote from the "Platforms State…

Don't read too much into it. That's just PR.

I'll start getting concerned when they rewrite any of their serious apps in Swift(UI). (i.e. Logic, FCP, Xcode, Finder, Instruments, iMessage, Mail, Calendar, etc.)

Re: Why I quit using SwiftUI

#33
post #13

The author talks about SwiftUI on macOS, which I also find to be much much more buggy than what's on iOS. Very unexpected things happen, like items in a specific region in the App UI stop responding to clicks next time once you interact with them. However I find it fine on iOS and the issues are usually around Apple changing something in the behaviour of the UI or API and breaking it, then you need to fix it for spec…

Tying the SwiftUI version to the iOS version is seriously asinine. In the Android world Compose is a regular library so devs can pick the version. That's partly why there has been much more adoption of Compose even though it was released years later than SwiftUI.

Re: Why I quit using SwiftUI

#34
I'm building an IDE in (mostly) SwiftUI, and have been using it since release, so I feel like I've worked with it more than most people.

A couple observations:

- SwiftUI is really complex

It's going to take you at least a year to get used to the declarative way it works, and be able to make UIs without struggling to figure out how to shuffle data around. If you look at SwiftUI examples/code, most of the complexity is hidden, but it's there, and you're going to have to interact with it to do anything non-trivial.

- Is SwiftUI the way?

SwiftUI has enabled me to build out huge amounts of beautiful UI quickly – faster than anything I've ever used. But you will run into things you can't do, forcing you have to fall back to AppKit/UIKit. And the area where AppKit/SwiftUI meet will disappoint and frustrate you. I just got done refactoring a huge amount of my app to use the "AppKit App Lifecycle" instead of the SwiftUI App lifecycle since I need some specific windowing behavior. Now I can't use .toolbar, .menu, and other stuff, which makes things much more complicated for me, and forces me to think about both SwiftUI/AppKit. Switching mental models like that, and trying to remember all the intricacies of both SwiftUI and AppKit is rough.

--------------

Regarding the performance issues of this specific post, my guess is they put everything into an ObservableObject, and used @Published properties to get bindings for their UI controls. This means any view with a reference to the ObservableObject gets re-rendered when @Published values change. Instead you need to silo your changes, so your entire App isn't redrawn every frame. This goes back to the complexity – it's not straightforward at all.

Re: Why I quit using SwiftUI

#35

Earlier quoted context omitted.

Then why use it anywhere? I have never fully bought into this notion that the components should rebuild themselves in this kind of stateless manner. I think this like an intellectual obsession with functional programming mapped onto the UI Tree. I can't fathom why it's 'better'. The reactive aspects of the middle tier of the program - that's progress. But the reactive components, I'm not sure about that.

>Then why use it anywhere? To write code quicker, and make it easier to maintain. If it's a moderately complicated UI, then I could code it up much faster in React (my guess is around 10x). IMO, React isn't about functional programming, it's just a good DSL for writing UI.

I don't buy that '10x' gain at all.

React Native doesn't seem to have any degree of simplification vis-a-vis regular Android Views for example.

On the web - that's a different story entirely, but when doing strict comparison I just don't really buy it for mobile apps.

The amount of code is similar, but with React you have to deal with extra layers of abstraction, and some things are obfuscated by the framework. No performance gain and often a performance lost.

Re: Why I quit using SwiftUI

#36

Earlier quoted context omitted.

> They are pretty wise for keeping SwiftUI be the "for kids" vanity UI toolkit to lure in React webdevs, while keeping UIKit and AppKit for serious stuff. At WWDC 2022 they specifically said that Swift+SwiftUI is the best way to build apps, and the future of their platforms. I thought AppKit/UIKit would stick around, but I guess not. --------------------------- Edit: Here's the direct quote from the "Platforms State…

There is no evidence to suggest that Apple are deprecating AppKit and UIKit

It'll be around for many years.

I know, for a fact, that some AAA applications are still using ObjC.

Also, I am quite sure (but don't know) that Apple still has a plenty big ObjC codebase at home.

Re: Why I quit using SwiftUI

#38
post #33
post #13

The author talks about SwiftUI on macOS, which I also find to be much much more buggy than what's on iOS. Very unexpected things happen, like items in a specific region in the App UI stop responding to clicks next time once you interact with them. However I find it fine on iOS and the issues are usually around Apple changing something in the behaviour of the UI or API and breaking it, then you need to fix it for spec…

Tying the SwiftUI version to the iOS version is seriously asinine. In the Android world Compose is a regular library so devs can pick the version. That's partly why there has been much more adoption of Compose even though it was released years later than SwiftUI.

I wonder what is the technical justification for it too, if any. I mean, sure - you can save space by making it a dynamic library that is shipped with the OS but considering how immature it is, shipping a specific version of it with the app should be an option IMHO.

Re: Why I quit using SwiftUI

#39

Earlier quoted context omitted.

> They are pretty wise for keeping SwiftUI be the "for kids" vanity UI toolkit to lure in React webdevs, while keeping UIKit and AppKit for serious stuff. At WWDC 2022 they specifically said that Swift+SwiftUI is the best way to build apps, and the future of their platforms. I thought AppKit/UIKit would stick around, but I guess not. --------------------------- Edit: Here's the direct quote from the "Platforms State…

There is no evidence to suggest that Apple are deprecating AppKit and UIKit

Supertankers turn slowly, but if the captain tells you the ship will turn, you better believe it, even if you don’t see the ship turning yet.

Having said that, even though Apple indicates it will turn, it still may change its mind halfway through.

Re: Why I quit using SwiftUI

#40
> I profiled the whole thing and discovered several things

Well done

After two years with Xcode/Swift/SwiftUI I never succeeded in getting anything useful out of the profiler.

Post reply on HN