Live data from Hacker News

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

triplebyte.com

1–10 of 76 posts

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

#2
I think the important thing to say is that there are already APIs which are SwiftUI only. This trend will definitely continue and in (near) future you won't have much choice.

While SwiftUI definitely lacks some finer customization of default elements (like the mentioned hairlines in the List/Form view), you can re-implement any UIKit view yourself in the end.

Lazy loading is perfectly doable, I think the author could have shown an example on how to do the carousel properly with a full example of the UIKit code.

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

#4
> As of June 2020, Apple Reports that 92% of devices introduced in the last 4 years use iOS 13, while 81% of all devices (including the oldest) use iOS 13. Some businesses are not willing to part with that remaining 8%-19% of users.

I'm surprised that so many people have the latest iOS. I was reluctant to use SwiftUI because I thought that more people have older iPhones which wouldn't support it.

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

#5
post #4

> As of June 2020, Apple Reports that 92% of devices introduced in the last 4 years use iOS 13, while 81% of all devices (including the oldest) use iOS 13. Some businesses are not willing to part with that remaining 8%-19% of users. I'm surprised that so many people have the latest iOS. I was reluctant to use SwiftUI because I thought that more people have older iPhones which wouldn't support it.

iOS 14 support goes back to the 6S and original SE, so the newest unsupported phone is the iPhone 6 from September 2014. Not a lot of those still around.

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

#6
post #4

> As of June 2020, Apple Reports that 92% of devices introduced in the last 4 years use iOS 13, while 81% of all devices (including the oldest) use iOS 13. Some businesses are not willing to part with that remaining 8%-19% of users. I'm surprised that so many people have the latest iOS. I was reluctant to use SwiftUI because I thought that more people have older iPhones which wouldn't support it.

iOS adoption rates are extremely high these days, especially with the long support periods devices get and various ways to reduce friction while updating.

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

#7
post #4

> As of June 2020, Apple Reports that 92% of devices introduced in the last 4 years use iOS 13, while 81% of all devices (including the oldest) use iOS 13. Some businesses are not willing to part with that remaining 8%-19% of users. I'm surprised that so many people have the latest iOS. I was reluctant to use SwiftUI because I thought that more people have older iPhones which wouldn't support it.

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

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

#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 where most things are outdated anyway. There's also lots of third party tutorials and what not that open with "Apple doesn't say anything about how this works, but I think I might have figured it out". And a lot of those third party sources are pretty good, but still. It's hardly ideal.

There are also a lot of inscrutable little edge cases where something just doesn't work, and there's hardly any path to figuring out why. Scrolling performance will tank, for example, after some trivial change. The framework "works like magic", until it doesn't. And you're stuck tweaking random things hoping something makes a difference.

BUT, at the same time, it's awesome. Code reuse is like, a real thing this time, not just something that works on paper but not in practice. You can compose things very quickly and succinctly, and you no longer have the unreadable, un-mergeable, unsearchable, existential nightmare that was storyboards. When it works, it really is fantastic. Don't count on the "live preview" though. That thing never works for anything other than the most trivial of examples.

If I could go back to 8 months ago, I probably would have chosen differently. But it is clear that SwiftUI is the future, and within a year or two it will be unequivocally better than UIKit. So if you're starting now... maybe. Just be prepared for some pain.

Post reply on HN