Hacker News new | ask | show | jobs
by sophiebits 2231 days ago
Curious to hear more about what SwiftUI does better than React… any place I can read more?
2 comments

Sorry for the late reply.

You can change state without all the annoying purely functional programming stuff ([... previousState, newValue]). Just change it.

You can change a prop passed in and even pass a new value up to the parent. So you know the pass a function down so the child can change a value in the parent? Just pass the variable you want changed down with @binding.

The official Apple tutorial gives you an idea what they were going for, but in practice it’s nowhere near that smooth.

In fact, most of the time I found myself staring at a “type too complex, add annotation” error. That one doesn’t actually mean your type is too complex, it just means you’re passing the wrong thing somewhere and instead of a useful error message the compiler just gave up and broke.

Errors in SwiftUI are significantly better in the recently released Swift 5.2, so this is clearly something they’re working on.
I certainly hope so, because this was definitely on Swift 5.2 . In general if you come in expecting a dev experience anywhere close to writing React in Typescript using VSCode, SwiftUI and Xcode both are a bit of a disappointment - it's slow, it's glitchy, autocomplete kind of sucks, never mind tooling like Prettier which I take for granted now.