Hacker News new | ask | show | jobs
by turdprincess 977 days ago
SwiftUI exists to solve exactly this problem - the ui is declarative and state driven.

However, its predecessor UIKit is mostly imperative and it takes a lot of manual code to keep the UI reflective of the underlying data model. For this reason I find many IOS apps, and especially apple’s own, to be always mildly broken.

Programming in UIKit is like programming in JQuery, or maybe Backbone at best.

SwiftUI brings us to the modern age of react (but with less capabilities and more bugs)

IOS developers though tend to be pretty resistant to such “modern” paradigms. If you read the rest of the discussion on this post, you fill find that even using Swift, let alone SwiftUI is still a very debated issue.

Maybe the grass is greener, but I don’t find the same resistance for new ideas in the web (typescript) or Android (kotlin) communities.

I do wonder if this resistance is combing from an objective evaluation of the new tech, or the lack of desire/time to learn something new.

4 comments

As a mobile dev, so far the biggest issue keeping me from adopting SwiftUI stems from its greenness and UIKit being so well fleshed out.

The newness is an issue because new SwiftUI revisions ship with new iOS releases, which means that big chunks of it are gated by the oldest iOS version you support. Jetpack Compose on Android gets this more right since it’s independent of the OS, but suffers from other tradeoffs (Java ecosystem and the rest of Android dev gives me a headache sometimes).

SwiftUI is also just missing various things that are present in UIKit, and so if you’re using those things it’s easier to write the whole app in UIKit instead of bridging those controls to SwiftUI.

I absolutely foresee going SwiftUI exclusive but realistically that’s still a few years down the road.

It's sort of dismaying that SwiftUI is regarded as a superior native choice as opposed to second-citizen cross-platform frameworks, then see examples like the macOS System Settings app. Though perhaps that is more of a case of poorly-executed Catalyst iOS to macOS porting, and poor design, than a lack of "nativeness" with SwiftUI.

The framework lacking consideration for navigation until recently shows that its rollout has been half-baked, though.

The problems with the macOS settings app have just as much or more to do with its design as they do with SwiftUI. If they had instead built the redesign with AppKit it’d feel a bit smoother in some areas but would be just as flawed. Just making it more traditionally Mac-like would go a long way.
I've heard a lot of disgruntlement from macOS developers about SwiftUI. I wonder if the framework has an inherent bias for iOS and maybe iPadOS? Again, it's crazy that after years of disparagement of kludgy cross-platform frameworks (albeit more from the fans than the company itself), Apple basically went ahead and built their own, with fewer supported frameworks than the third-party alternatives.
SwiftUI definitely has an iOS/mobile bent to it, no doubt because iOS is its flagship platform. macOS no longer has the corporate gravity that it enjoyed prior to the iPhone, when AppKit received most of its post-NeXT development.

This problem isn’t exclusive to SwiftUI though, WinUI/Windows App SDK is also mobile-flavored likely due to its UWP heritage, lacking basic desktop widgets like a tableview/datagrid.

> This problem isn’t exclusive to SwiftUI though, WinUI/Windows App SDK is also mobile-flavored likely due to its UWP heritage, lacking basic desktop widgets like a tableview/datagrid.

Hah, it's far worse than that - Microsoft has let their desktop DX story stagnate for 15 years now (WPF was launched in 2006), since then Microsoft hasn't launched any new desktop-first UI framework for Windows, nor offered more than token improvements to User32, CommonControls, and WinForms since then.

It's no lie that everything MS has done in the UI-framework space since Windows 7 in 2009 has been a waste of time and money. It started-off with the "Metro" Windows Phone reboot, then the shoehorning of that into Windows 8, and the various XAML-derived frameworks since then - and none of them have attempted to tackle the very fundamental flaws (declarative data-binding doesn't scale, INotifyPropertyChanged breaks causality tracking and cannot be unit-tested, mutable ViewModels were carved by Lucifer himself!) - and as you said, no care or attention is paid to applications needing high information-density display.

----

...so while all this is going on, the Office org came up with its own in-house GPU-accelerated UI introduced in Office 2013 which we can all agree is slow, bloated, glitchy (y'ever used Excel with a 500Hz mouse?), but also proprietary and undocumented, so the wider Windows ecosystem can't benefit from the Office org's framework which would have otherwise (almost) neatly filled the gaps left-behind by the Windows org.

I just want Satya to hire me for the job-title of "VP of Consistent User-Experience" and I'd make it a top-priority that Windows itself comes with a reusable spreadsheet+datagrid component that all applications can use - and it wouldn't cost the company more than a year and a few million dollars - but save billions by avoiding lost developer confidence - and would serve to remind everyone that native desktop UX can always be better than browser-based UX.

---

Sorry, am ranting.

The rumors I heard were that SwiftUI was originally meant to launch for watchOS first, to fill in the (sizable) gaps with the UI framework there.

I suspect even though it was always meant to be a cross-platform UI framework, the initial layout system was designed more toward composing and filling a smaller fixed space than for dealing with large resizable windows.

I think flutter is emerging as a compelling alternative for cross platform desktop development. I’m building a desktop app in it now and so far the experience has been quite positive.
Might also be because Cocoa on the desktop had many problems solved already that are being solved by SwiftUI on mobile now. For example bindings to keep views in sync with a model.
I’ve been writing code for Apple platforms for over 15 years at this point and I still occasionally find myself surprised with how far one can take a Mac app with little more than Interface Builder and Cocoa bindings.
Settings is not a Catalyst app; it’s a poorly designed full rewrite.
Well that’s just inexcusable.
I agree that navigation in a pure SwiftUI app is annoying, but I don't think that was short sided. It's just iterative design.

At the start SwiftUI was something you could add to an existing UI/AppKit project, so individual parts could be rewritten. They've been building on top of that since. Refining the api and slowly letting you write more and more with just SwiftUI

The implementation seems to encourage that "leaf" views have to be aware of parent views, or what context they're in. I used to work with a guy who'd always say, "maybe I'm holding it wrong," that's how I feel about the navigation in SwiftUI. Maybe I need to see a clean example to get it.
I tried building a fairly basic app with swift ui and at this point I suppose I’d say I gave up. I got maybe 90% of the way fairly easily, but the final 10% seemed like it would be misery given the documentation and the issues I was encountering.

There’s a ton of potential there and I’m looking forward to having sufficient APIs and documentation to work efficiently with it. At this point it’s kind of painful for a hobbyist like me.

I'm really surprised at how little SwiftUI has come in 4 years, I hope it'll get better. My biggest problem with it is that often as soon as you need to do something slightly complicated it becomes a huge nightmare. It's almost always just easier to use UIKit
> IOS developers though tend to be pretty resistant to such “modern” paradigms. If you read the rest of the discussion on this post, you fill find that even using Swift, let alone SwiftUI is still a very debated issue.

Resistance to SwiftUI has more to do with the incompleteness and bugginess of the framework than a refusal to embrace modern paradigms.

A common impression of SwiftUI is that it makes hard things easy and easy things hard.

>brings us to the modern age of react

Thanks, I vomited a bit into my mouth.

I’m a web developer and I hate React and TypeScript. I love jQuery.
It's hard to make client-side webapps, using a procedural programming paradigm just makes it harder than it needs to be, but using jQuery for anything else is exactly why it got popular.
What’s hard is making up languages that compile down to JS/HTML/CSS, debugging through source maps, having 50k dependencies just to create a view to choose between 3 shirt sizes and 2 colors.

What’s not that hard is managing a bit of state and writing sensible CSS to make it reusable.

As someone who worked in a decently sized company working on a software product written with TS/HTML/SCSS (at least we had those) and jQuery: no, absolutely not.

as the apps get big, state becomes a mess, fully reusing code is very hard, making anything even slightly reactive becomes not only a lot of code, but a jumbled mess of mutability, usually copy pasted from somewhere else. I will take any other type of app over that - I don't care if it's angular, vue, react, next, whatever.

So i contend that not only is "managing a bit of state and writing sensible CSS to make it reusable" very hard, I haven't even seen it done ever, at least in my personal experience of the code I touched

Yes, exactly. The requirements of most functional production applications on the web already have so many complicated bits to get right, people shouldn't be burning their energy on what end up being inane details like synchronization UI with state.

At a much much smaller scale however, jQuery and CSS or in many cases just HTML and CSS will do just fine. Knowing which approach to take is the mark of someone with some level of experience above junior.

> people shouldn't be burning their energy on what end up being inane details like synchronization UI with state

Instead they burn an insane amount of energy (and unfathomable bandwidth) inventing, learning and debugging crazy abstractions and build systems (that change every year or so) on top of the native platform that is the web.

It really feels like a collective bad trip that I hope the industry wakes up from, eventually. But after more than a decade of this insanity, I’m not holding my breath.

Those are also hard, but supportive tooling to make that process run more smoothly is part of the decision-making process of whether or not to choose which tools for the requirements of your contract.

Sometimes you choose hypothetically difficult debugging if it eliminates the need to deal with the mechanics of the lowest level of interacting with a system. If you haven't needed to do that, then you'd be inclined to think it's an unlikely situation to be in.

They hated him because he spoke the truth