Now we are a couple of days into DUB DUB (WWDC) — 2019. And one thing got me really exited (Like, I screamed «YEEES!» at the TV), and this on thing was not the Cheese grater Mac Pro, nor the new display; but it was SwiftUI.
What exites me about SwiftUI is that it reminds me a lot of another technology I love; Flutter.
So why is it so familiar? Well, SwiftUI is a declerative framework for development across the Apple platforms 🍎
SwiftUI seems to be taking the approch I’ve gotten used to with Vue.js, React Native and Flutter. Building UI’s with components, and combining them into bigger components and applications. But as I’ve already said: SwiftUI reminds me alot of Flutter, so I will compare it somewhat to that.
And this example will show some those smiliarities:
Everything is a widget in Flutter. And to write a simple app with a stateless widget that fills the screen with «Hello World!» this is what you have to do.
The focus here is App(), the code in MyApp() is there simply to make the screenshots more compareable.
This renders the following:
Pretty nice! That was not a lot of code 😁
So to SwiftUI. Hold on, this is gonna be quick….
After you start a new project in Xcode and check the «use SwiftUI» box. This is what you get, and this renders to the following:
Woah! That’s pretty similar, and still very little code! And, it sort of looks like the Dart code!
Well, I know there is a lot of differences between the two languages, but after playing around with SwiftUI I feel like SwiftUI and Flutter provide very similar feeling Developer Experiences. Focusing on rapid development with components (Widgets in Flutter, Views in SwiftUI), and both frameworks makes me feel good and powerful. I feel like I can do stuff quickly in both of them!
I will eagerly watch the different sessions on SwiftUI, and hopefully build something with it this autumn.
I think this is a sneek-peak into where mobile application development is going. And, I like it alot 😎
If you want to read more about this on a more technical level, I would like to recommend John Sundell’s articles over @ wwdcbysundell