8 ms·
I really enjoy swiftUI. It appears like it tried to emulate react and succeeded on a few fronts, is better in a few fronts (child modifying parent variable), an
by Diesel555 6y ago
I really enjoy swiftUI. It appears like it tried to emulate react and succeeded on a few fronts, is better in a few fronts (child modifying parent variable), and worse in a few fronts (side effects).
That being said, my experience with SwiftUI users is that they don't like it because it is so different from the standard Mac experience (props and re-renders and state...). And the documentation is poor (IMO has been Apple standard from MapkitJS to iOS Swift documentation to SwiftUI) which leads to a negative dev experience. Try finding what causes a component to re-render in SwiftUI vs React. If you find it great and please post it, but it's not easy to find in my simple research.
- sophiebits 6y agoCurious to hear more about what SwiftUI does better than React… any place I can read more?
- doteka 6y agoThe 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.
- kitsunesoba 6y agoErrors in SwiftUI are significantly better in the recently released Swift 5.2, so this is clearly something they’re working on.
- doteka 6y agoI 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.
- Diesel555 6y agoSorry 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.
- josephg 6y agoI’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.
- ksec 6y agoThat 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) https://en.wikipedia.org/wiki/Dylan_(programming_language)
- zapzupnz 6y ago> 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.
- fpoling 6y agoSometimes I wonder if Apple documentation for developers is bad on purpose to attach people to the platform via Stockholm syndrome. Like recently I spent days tracking an issue with AVFoundation framework. Finally I found a clue on a obscure blogpost which explained how to use a particular interface properly and, more importantly, what are typical mistakes. This had to be documented by Apple in the first place. Instead people had to figure out quite a few ways to deal with it.