Live data from Hacker News

Should I use SwiftUI in production? A code-to-code comparison to help you decide

triplebyte.com

21–30 of 76 posts

Re: Should I use SwiftUI in production? A code-to-code comparison to help you decide

#21
Where it works, SwiftUI is indisputably the most compact and maintainable form of data bindings and auto-layout that you have. It should be used immediately for those working cases.

It is therefore critical to also learn the bridges (e.g. how to get a platform-specific view or controller out of SwiftUI) because you will also want those somewhere.

Note, I have seen Herculean attempts on blogs, etc. to shoehorn ungodly amounts of hacks into SwiftUI objects to get certain behaviors that don’t exist yet; That Is Wrong. Do not fight this framework; either use a native element with full functionality and a bridge, or a succinct SwiftUI description. It is clear that “someday” everything will have a nice SwiftUI version and it isn’t worth faking it for now wherever it doesn’t work yet.

Re: Should I use SwiftUI in production? A code-to-code comparison to help you decide

#22
I'm using it in production, but a few situations that I could handle with autolayout constraints seem impossible in SwiftUI. Examples here: https://developer.apple.com/forums/thread/664283 In these 1% cases, I can make things "good enough" by hacking it with SwiftUI. But it bothers me. Sometimes I want to go past "good enough" and reach for "perfect". I could do that with UIKit/AppKit, but with SwiftUI they haven't documented (or created) the layout system to allow it.

Re: Should I use SwiftUI in production? A code-to-code comparison to help you decide

#23
post #18

SwiftUI is pretty and a pleasure to work with when you want to do something that is expected. The moment you need something more, SwiftUI is not your friend anymore. Too much is hidden away in internal implementation details and much of it is broken, incomplete or completely missing. It may be adequate on iOS, but on a Mac it is nowhere near usable at this stage.

How did you find out about this?

First hand experience.

Re: Should I use SwiftUI in production? A code-to-code comparison to help you decide

#24
post #9

I've been working full time on an app in SwiftUI for the past 8 months or so. I'll sum it up this way: I frequently oscillate between thinking "This is amazing, it truly is a joy to work with SwiftUI" and "Holy FUCK this is the most infuriating thing I've ever experienced in my life". I can't comment on the documentation, because there isn't any. The closest thing you get is the WWDC videos from the past few years wh…

I don’t understand why Apple doesn’t just document this. Is the team responsible for it just pro-UIKit and doesn’t actually want people to use SwiftUI or something? Because the lack of documentation for so long really does give me the impression that they actually don’t want people to use it. It’s hard to believe it could just be incompetence.

Re: Should I use SwiftUI in production? A code-to-code comparison to help you decide

#25
post #14

Earlier quoted context omitted.

As per this Wikipedia article[1], more than 2 billion iOS devices were sold by September 2018. 19% of 2B is 380M devices. So by going iOS 13 only quite a few potential users are left out. [1] https://en.wikipedia.org/wiki/List_of_iOS_and_iPadOS_devices

Though I wonder what fraction of those people are interested in installing new software? I wouldn't be surprised if it was pretty small.

Maybe. On the other hand, maybe they're likely to engage more with the few apps that still support their version of ios.

Re: Should I use SwiftUI in production? A code-to-code comparison to help you decide

#26
post #24
post #9

I've been working full time on an app in SwiftUI for the past 8 months or so. I'll sum it up this way: I frequently oscillate between thinking "This is amazing, it truly is a joy to work with SwiftUI" and "Holy FUCK this is the most infuriating thing I've ever experienced in my life". I can't comment on the documentation, because there isn't any. The closest thing you get is the WWDC videos from the past few years wh…

I don’t understand why Apple doesn’t just document this. Is the team responsible for it just pro-UIKit and doesn’t actually want people to use SwiftUI or something? Because the lack of documentation for so long really does give me the impression that they actually don’t want people to use it. It’s hard to believe it could just be incompetence.

The documentation for everything lags years behind now. The only reasonable explanation is just that they have far too few people working on docs and don't consider it an important thing to hire more people for.

Re: Should I use SwiftUI in production? A code-to-code comparison to help you decide

#27
post #24
post #9

I've been working full time on an app in SwiftUI for the past 8 months or so. I'll sum it up this way: I frequently oscillate between thinking "This is amazing, it truly is a joy to work with SwiftUI" and "Holy FUCK this is the most infuriating thing I've ever experienced in my life". I can't comment on the documentation, because there isn't any. The closest thing you get is the WWDC videos from the past few years wh…

I don’t understand why Apple doesn’t just document this. Is the team responsible for it just pro-UIKit and doesn’t actually want people to use SwiftUI or something? Because the lack of documentation for so long really does give me the impression that they actually don’t want people to use it. It’s hard to believe it could just be incompetence.

Yup, I wonder same thing. Besides the docs, it's the lack of comments and help on the "developer forums". They are content to let developers flail and struggle with a topic for years rather than take some time to help. It comes across to me as gross arrogance, but it could be something else.

Re: Should I use SwiftUI in production? A code-to-code comparison to help you decide

#28
Agree with all the comments here. Once you get your head around it, it’s fast and capable – until you run into a corner case it doesn’t support (attributed text was the big one for me). Then you end up needing to wrap UIKit, which is straightforward except there is a new set of corner cases to deal with, eg. content sizing, embedding in native scroll views, etc. It all does work in the end but it takes a while to get there, and I know I’ll be replacing a lot of code as SwiftUI evolves. Having said that, it’s probably a better situation than releasing a half-baked but more featured framework.

Also yes, the documentation is terrible.

A few things I found helpful - https://gist.github.com/lhoward

Re: Should I use SwiftUI in production? A code-to-code comparison to help you decide

#30
I've been using SwiftUI for macOS and iOS fully to make stayinsession.com

It's my first app while I'm learning Swift. Coming from React, the transition is relatively easy. I did learn some UIKit and AppKit and find it extremely verbose.

The thing is SwiftUI is not really ready for prime time. There's a lot of bug and inconsistencies here and there. Things that work on iOS doesn't work on MacOS. Vice versa.

Keyboard navigation and input focus sucks.

Minor update (like from iOS 13.1 to 13.2) could break some part of the app.

Also performance is not optimized. I have a slideshow that took at least 10% CPU on Mac all the time. That limitation makes me decides to use animation sparingly across the app.

But again, the productivity is no brainer.

Basically my iOS and macOS app lives in monorepo because there's ~95% code sharing.

Post reply on HN