Hacker News new | ask | show | jobs
by josephg 2231 days ago
I’ve spent the last week learning SwiftUI to see how hard it would be to reimplement Notion in a performant way. It seems really ... unfinished. Like, the default List view is really hard to style. I spent 4 hours yesterday trying to get an unstyled text Button to have a hit target bigger than the characters themselves. Adding a frame with a background worked, but if the frame had no background (or a transparent background) then the hit target would stay tiny. I ended up fixing it by just reading through every property method in swiftui and guessing. It reminds me of web development in the early days of jQuery.

If the SwiftUI code were opensource it would be much more pleasant - I could paw through the code if I needed to, file issues, and so on. But the whole experience compared to writing typescript with VS Code is shockingly bad. With the preview open Xcode sometimes stutters so much that it misses key presses - so I’ll type a function name and it’ll come out missing letters, because apparently I wasn’t typing slowly enough for my $3000 computer from 2016 to keep up.

That Xcode gets trounced in developer experience by vs code - an IDE running on electron - is really a testament to the work Microsoft has put into performance. And it should be hugely embarrassing for Apple.

2 comments

That is the thing I dont like about the current Apple.

They used to release things where you see they put a lot of thoughts into it. Now they are half baked. This isn't so much a problem on Apps ( The Product ) where it is constantly being updated and tweaked. But with code you have the hassle to try and keep up. And the pace of improvement is very very slow. To put things into perspective, Swift UI has been development for 4 years. Not exactly the state of things I would like it to be.

Apple also isn't dogfooding much with Swift. And I think that is great. In many ways I starting to feel Swift is like Dylan [1], it is new, it is exciting, and it is fun. But somehow after nearly 6 years Objective-C stills feels better. The syntax may still be god damn awful, but it is small enough to be called elegant. While Swift felt like C++ with better Syntax.

[1] https://en.wikipedia.org/wiki/Dylan_(programming_language)

> Apple also isn't dogfooding much with Swift.

That's because it didn't have a stable ABI until Swift 5, released last year. Now that it does, a lot of their iOS/iPadOS apps have been rewritten, at least partially but sometimes fully, in Swift; this includes some of their Catalyst apps on Mojave and Catalina.

The only app I know for sure to be fully written in Swift, thus far, is the Apple Developer app (previously called WWDC), but I know there are others (they were mentioned in last year's WWDC sessions).

> Swift UI has been in development for 4 years

I must have missed this. Where did you hear this? I'd love to see more info about that.

The lack of a stable ABI had nothing to do with preventing Apple from shipping apps written in it.
>I must have missed this. Where did you hear this? I'd love to see more info about that.

Chris Lattner said in one of the pod cast, I think it was Accidental Tech, where Swift UI started before he left Apple. Since that was 3.5 years ago, Swift must have been close to 4 years of work.

Well, that may be, but we don't know when a concerted effort began. Just a guess, but this was probably a small team (or individual) trying some things out as an R&D project to see if it had legs. At some point there was enough promise so that the company put serious effort into it. That might have been 2 or 3 years ago. At any rate, it has company focus now.
> But somehow after nearly 6 years Objective-C stills feels better

This experience is shared by basically nobody? I used to love Objective-C, which was unusual even before Swift, but I would not in a million years switch back to using it. Swift is so much better in every single way.

I share it. I love Objective-C and feel its a far superior language over Swift. Swift is too clever by half, with its var, let, func, and the god awful question marks. Objective-C is verbose sure, but that helps readability. I'll never switch to Swift, as Objective-C is so much better in every single way.
I don't get the feeling you've really given it a fair chance, or tried to understand why it does what it does.

Swift really is much more readable than Objective-C, too.

I have on both counts. I tried it a couple times and hated it. I've read the book and others justifications for it, but disagree.

Swift is absolutely less readable than Objective-C. Objective-C is known for its verboseness, which makes it easy to read. Swift has all kinds of easy ways to make it less readable, like the question mark. There is no way one can objectively argue Swift is more readable than Objective-C.

Your assertions aren't backed up by anything; your criticisms of Swift are superficial and reek of "I'm unfamiliar with it, therefore it's bad".
Yeah. There are _aspects_ of Obj-C that are still nice, but as a whole I find Swift way better to work with on day to day basis. For that matter, I prefer it over syntactically similar languages like Kotlin too. If I could just write Swift everywhere that’d be great.
At least all host of Accidental Tech podcast shared similar feeling.
Needs to be said. Apple doesn't seem to give a toss about performance or developer experience so long as it has something to demo at its annual developer conference.