SwiftUI OMDb search experiment

05 Jun 2019

SwiftUI, announced yesterday at WWDC, is very cool 🤓. Allowing you to create your UI with a declarative style it seems to reduce a lot of boiler plate code. And as mentioned in a post I wrote about Flutter (which also adopts a declarative style), I think it will naturally encourage reusability and cleaner code.

For the chance to mess around with it a bit, I reproduced some of the UIKit OMDb client I talked about in my previous post. Although it took a little getting used to, the number of lines for features I reproduced in SwiftUI were generally reduced. And, although I’m sure what I wrote won’t match future best practices, I think I preferred the style of the code I wrote with SwiftUI to that with UIKit.


Although I’ve not yet had a go with some of the new XCode features related to SwiftUI (they need Mac OS Catalina), the support for SwiftUI looks even better than the support for Flutter on Android studio. The hot reload and new ‘interface builder’ that provides shortcuts but doesn’t make you give up the power of programmatically defining your UI looks incredible.