DEV Community

Nathan Mattes
Nathan Mattes

Posted on • Originally published at zeitschlag.net on

100 Days of SwiftUI — Day 16

Technically, today yesterday — as I forgot to write this exact blogpost — was the first day of this whole thing I spent writing some SwiftUI-code. Nevertheless, it was already day 16.

It was a very nice little introduction to this whole topic. I immediately understood, why people like SwiftUI. With very little code, you can build a pretty powerful UI. Lots of things you have to take care of when writing apps with UIKit are just done for you, like Autolayout. Also building rather simple forms is a matter of minutes instead of using a third-party-library.

Oh, and I like this two-way-binding thing using a $. Using this character is a neat detail. It might let your code look like PHP or Perl, but it will magically work. Just like Perl.

What confused me a little was the the code shown in the last video differed from the code in the blogpost. The type of selectedStudent was a String in the video, but an Int in the blogpost-code. In the end it doesn't matter, it works both ways.

I'm curious on how to build very custom UI in SwiftUI and how to mix it with some architecture, as storing the @State in the View doesn't feel very good to me.

Top comments (0)