SwiftUI tutorial with Stanford

Hope I can finish it

By ahchao in Learning Swift

September 7, 2021

Today I became a student at Stanford University, sort of. I took one of their classes so that counts right?

I have been intriged by SwiftUI since it is a new thing (it has just been out for ~2 years ago), and since I have been touching React Native for the past 2 years, I want to see if concepts relate and if it will be easier for me to pick it up.

So what is SwiftUI? Let me direct quote:

SwiftUI is an innovative new way to build user interfaces across all Apple platforms, so you can create better apps with less code. With a declarative Swift syntax that’s easy to read and natural to write, SwiftUI works seamlessly with new Xcode design tools to keep your code and design perfectly in sync. Automatic support for Dynamic Type, Dark Mode, localization, and accessibility means your first line of SwiftUI code is already the most powerful UI code you’ve ever written.

Basically, it is a new declarative framework for building UIs on Apple platforms, and it was released on iOS 13 to the public in September 2019 that included this new framework. If your app is not for iOS 13 and above, you won’t be able to use it.

I once attended a recruitment workshop (if you can call it that) for Audible. Audible app has been around for a long time, so it is a mix of Objective-C, Swift and of course SwiftUI. They are also slowly moving towards SwiftUI if possible, so I thought to myself SwiftUI probably has merit to earn a place there, and given that Apple is moving towards SwiftUI why not learn something new. React Native has been out for so long (2015 till now, 6.5years) and yet it is not even version 1. Granted Apple only has to take care of it’s own platforms and the integration with Xcode, and React Native has to take care of both platforms, but it is still not very complete and far away..

Both of them are declarative style programming instead of the imperative style that we are used to. Today is my first day of ‘class’, and I realise that it is indeed very similar, but the integration with the Apple ecosystem is so much tighter and better to use. There is so much that Apple provides. But let’s reserve judgement for another day. We shall see how it goes…

If anyone is interested in taking up the free course as well, you can find it here https://cs193p.stanford.edu

Update: 10 Sept 2021

Apparently SwiftUI is heavy on MVVM, and it’s using Combine framework (it seems to work for UIKit too but more geared towards SwiftUI) behind the scenes to make it reactive. I think for UIKit there is RXSWift and stuff but I am not sure on those yet. Some of the concepts are abstracted (at least for now) as compared to React Native. It is also smart enough (duh!) to not recreate views that underlying models has not changed.

Update: 18 Sept 2021

I am up to Lecture 6 now, and so far it is quite good (kinda) at introducing Swift and SwiftUI. I really want to continue, but ugh I have been so busy recently, I do not have time to work on this. Looks like this will take a backseat for now :(

comments powered by Disqus