by erikrothoff · 6y ago · 0 comments
After 30 minutes of updating Xcode I was able to start writing SwiftUI code. Then another 2 hours upgrading our Swift project to the latest version of Swift. I googled for documentation, found barely anything and the code samples on developer.apple.com were already outdated. I finally got something up and running, but _nothing_ in the semantics worked as expected. Getting a button to render nicely was insanely complex (which view should have the background color? font? trying different things didn't work at all). Oh and recompiling took a minimum of 30 seconds each time.
All this prompted me to finally give react-native a try. In under 15 minutes I had a working example. After making a change I saved the file, alt-tabbed to the simulator and the changes were already applied. And it works instantly on Android, I can try it out on my phone using expo without any hassle.
I just can't comprehend if and how Apple will catch up with that experience?
The fact that you, a React developer with lots of experience with React were able to come up to speed vastly quicker on React Native shouldn't be surprising, that's a feature of the platform. You are the exact sort of person React Native was designed to make productive.
Of course you struggled, to pick up Swift UI, you needed to learn a new, vastly different language, and a new DSL that sits atop that language.
Even with good documentation and years of community expertise built up, this would have been an uphill comparison, but SwiftUI is relatively new—essentially in beta—there is very community around it and as you noticed, very little documentation... all of these last issues are pretty well known. All of them take time to overcome.
I'm not sure if SwiftUI is going to be the next big thing or not, but your comparison is a bit lopsided here.
I think time is the big decider here. Swift is new and given Apple's relatively slow update cycle (annually versus quarterly or more often for open source projects), it'll be a few years before SwiftUI really matures and (hopefully) a community builds up around it.
This year's Apple Dev Conference (If it happens) should push things forward and hopefully increase the quality and quantity of documentation at the least.
The number 2 item on Swift Core Teams goals for Swift 6 is "Create a fantastic development experience". See: https://forums.swift.org/t/on-the-road-to-swift-6/32862
Whether anyone at Apple cares about documentation any more is another matter. A really sad state of affairs, because once upon a time, Apple had some of the best documentation out there. Of course, that was when they actively needed to court a developer community, and couldn't just announce something half-baked at WWDC and get mass adoption from enthusiastic developers.
It's just cutting edge tech.
I agree SwiftUI is poorly documented and (from what others say), probably, not quite production ready, but I also guess that comparison is a bit unfair. Or are react and react-native completely different beasts?
> Or are react and react-native completely different beasts?
The language is the same, and the core concepts are the same, but the SDK's are completely different. You are using different build tools, different API's, different platforms. It's not HTML-in-JS. So a React developer is not going to be fluent in react-native by default.
For a simple hello world SwiftUI app? I just checked a project I had open in xcode and it recompiled in under 1s. Thats on a mid range 2013 MBP.
> After making a change I saved the file, alt-tabbed to the simulator and the changes were already applied.
I guess Apple is aiming to get something like this experience through previews, which are a little broken right now.
Edit: formatting
I think the picture is darker than what you’re describing : as long as apple doesn’t provide a real cross-platform environment (like google does with flutter, or facebook with react) then it doesn’t really matter what they end up doing with swift UI.
My intuition is that they know it, and that they’re working on something pretty big in that field, maybe as an improved , cross-platform version of swift ui. That would explain the lack of documentation (why document something that’s only a temporary version of a tech). But maybe i’m dreaming and everybody at apple live in its own bubble...