SwiftUI Discovery - Part 1

While the last WWDC keynote was again a display mostly aimed at journalists, presenting new machines rather than focusing on software, it wasn’t without Craig Federighi dropping a massive bomb in Apple development world at the last minutes.

Presenting SwiftUI, a new UI layer for iOS, replacing UIKit, entirely written in Swift.

Its light architecture made of structures makes it possible for Xcode to compile and preview it on the fly like no other IDE did before. Truly mind-blowing!


A few month past, I decided to give it a try using one of Apple tutorial, and it is amazing. Its declarative syntax and tight coupling with Xcode makes it so easy to learn, visualise and organise.

What struck me the most is how easy Apple made it to populate Views with Models:

struct LandmarkList: View {
    var body: some View {
		List(landmarkData, id: \.id) { landmark in
			LandmarkRow(landmark: landmark)
        }
    }
}

By only passing model directly in the structure as an argument (line 2) and then, beautifully parsing through that array directly using the List component in a declarative manner (line 6).

It removes lots of barriers for the new generation to code more powerful apps, focusing on business logic more than low-level problems.

Thanks Apple for doing it again.

Tancrede ChazalletSwift, iOS, SwiftUI