Live data from Hacker News

SwiftUI in 2022

mjtsai.com

81–90 of 216 posts

Re: SwiftUI in 2022

#81

I'm really looking forward to what comes of it, but I have chosen to do my current major project in UIKit. A couple of reasons: 1) The documentation for SwiftUI, when I started (about two years ago) was awful . I was shocked at how bad it was. I believe that it has since improved. 2) I knew of no major apps (even Apple ones) that had been done with it. I already knew that UIKit was up to the task, and held my nose, w…

> I like things like the MVVM pattern, but it's been my experience that it's really not such a good idea to implement it in UIKit, because UIKit was designed explicitly for MVC. I have learned that those ugly-ass UIViewControllers are really important, and I circumvent them at my peril. I agree with everything you've said but this. I've worked on 3 very large app, one which is 85% using mvvm, the two others were stil…

I have heard many state that. It has not been my experience.

It may be because I want a "pure" MVVM, and it has to be sort of "impure" to work with UIKit apps. In that case, it just adds more code. I'm a "the best code I write, is the code I don't write" kind of guy.

Re: SwiftUI in 2022

#82
post #54

Earlier quoted context omitted.

> You could write an opposite article featuring people using SwiftUI that have never touched UIKit or iOS code before and it would be nothing but glowing praise. How can one properly evaluate it with no point of comparison? If you've never tasted chocolate, then vanilla might seem like the greatest flavor ever.

The point of comparison is that it has given people the ability to develop their own iOS apps from scratch, when previously they could not as UIKit was too daunting and the tools were not as advanced (live preview with swiftui/etc).

SwiftUI is not less daunting than UIKit. In fact I would say that the SwiftUI "magic" is far scarier for beginners than IBOutlets and UIViewControllers

Re: SwiftUI in 2022

#84
I really wish Apple had spent more time updating the limitations of UIKit before introducing SwiftUI. Stylesheets are the most obvious piece missing, but even adding a simpler layout model would be a big quality of life improvement. I'm often faced with a storyboard where i have to blow away half the constraints to add in a new feature to the existing layout. On android I've never had to do this.

Re: SwiftUI in 2022

#85

Has anyone gotten SwiftUI previews to work at all with a project that has more than 20 files or some dependencies? My project utilizes Firebase as the backend and as soon as you add that dependency - SwiftUI previews never compile, due to build time outs.

You are probably pulling firebase into your preview code somewhere. You should structure your previews to depend on mock implementations of your model (or mock data). It will make the previews much faster and more reliable. My app also uses firebase and SwiftUI with hundreds of files (views, view models, and more) with no problems.

+1 on this

Got working SwiftUI previews on a 50-100k LOC project with many big libs as dependencies, must be hundreds of files but havent counted. SwiftUI code is gaining share of the total UI code, probably around 20-30% now

Mock data is a must.

Need to be mindful of the preview build (+ preview simulator startup) time too, sometimes it will timeout but just building again (now warmer) will make it work

Had some initial issues around processor arch (Intel vs M1/arm), think I’m still running XCode under rosetta otherwise it wouldnt work.

Re: SwiftUI in 2022

#87

Lots of great and specific points in these threads, many of which I have personally seen. SwiftUI was really promising at first, and even fun to use (nothing like ripping out entire UI files or pages of code). Yet, issues were almost immediately apparent. A major concern is that it seems to take Apple a really long time to address even basic issues, e.g. years go by and things still broken since day 1 are there, whil…

> deprecate Combine and move further toward actors and async APIs

Combine is an abstraction to encapsulate changes in state over time, while actors and async APIs are abstractions to encapsulate concurrent behavior. I think these are orthogonal concerns, so they wouldn't likely drop one in favor of the other.

> SwiftUI is very dependent on Combine

As someone who's been writing SwiftUI a lot over the last year or two, I've only touched Combine a few times. Even then, I only tried it because I wanted to see how it compares to RxSwift, not because it was something I needed.

Re: SwiftUI in 2022

#88
post #17

Things were easier when it was just Objective-C and UIKit / AppKit. Swift killed my joy of making iOS apps.

How is Objective-C easier than Swift.

Objective-C can feel easier to different types of developers for different reasons.

For disciplined developers who always dot their I’s and cross their T’s, it feels easier because they can write code with full “trust” from the compiler that the developer knows what they’re doing.

For undisciplined developers, it can feel easier because the compiler isn’t calling them out on code smells and inattentiveness to nullability and types.

I’d like to think I’m somewhere in the middle (as I suspect most devs are) and for me Swift feels easier in most respects, even with its everything-and-the-kitchen-sink nature compared to Objective-C’s more spartan approach.

Re: SwiftUI in 2022

#89
post #70

I've tried both SwiftUI and Jetpack Compose (the equivalent framework for Android). While conceptually they are very similar frameworks, in practice I found that Jetpack Compose + Kotlin had a far superior development experience than SwiftUI + Swift. I genuinely cannot think of a single thing that SwiftUI does better than Jetpack Compose. There are a lot of fundamental design decisions in SwiftUI that are questionabl…

You can do control flow on SwiftUI Views? Checkout @ViewBuilder...

Re: SwiftUI in 2022

#90
post #54

Earlier quoted context omitted.

> You could write an opposite article featuring people using SwiftUI that have never touched UIKit or iOS code before and it would be nothing but glowing praise. How can one properly evaluate it with no point of comparison? If you've never tasted chocolate, then vanilla might seem like the greatest flavor ever.

The point of comparison is that it has given people the ability to develop their own iOS apps from scratch, when previously they could not as UIKit was too daunting and the tools were not as advanced (live preview with swiftui/etc).

[deleted]
Post reply on HN