Simple note about Swift UI vs Auto Layout

Simple note about Swift UI vs Auto Layout

Opening

Bismillah
SwiftUI and Auto Layout is both are methods or a way to creating view / user interface when we develop app with Xcode for IOS and another Apple platform, they are use for same purpose (to create ui) but they has many of difference, on thins article insya Allah, we will go and see and compare them!


What is SwiftUI

according to the official Xcode webpage

SwiftUI is an innovative, exceptionally simple way to build user interfaces across all Apple platforms with the power of Swift.

SwiftUI is a newer, modern way to build ui on Xcode, using the swift declarative syntax, offering a simpler, easier and faster UI development, Swift UI was introduced by Apple at WWDC 2019

Code bellow is SwiftUI Example

@main
struct SwiftUIApp: App {
    var body: some Scene {
        WindowGroup {
            Text("Hello world")
        }
    }
}

If you notice is SwiftUI is much similar with Dart's Flutter


What is Auto Layout

Auto layout is old a feature on Xcode , it also simple and interesting and fun!, with Auto Layout we can create a user interface with drag and drop and dynamic, Auto layout was older and used the brand new SwiftUI


Swift UI vs Auto Layout

ok now let's compare SwiftUI and auto layout. SwiftUI it one who i more recommend, is modern, is generally is faster, is simpler (for me) and many things again, But in other hand, Auto layout or StoryBoard is just much more approach for beginner programmer to who just enter mobile programming, is also cool and fun to do drag and drop, and.. the one that big advantage is Auto Layout support older version of IOS


Conclusion

Is whatever things you use to build an app on Xcode, you also can learn both of the way (SwiftUI and AutoLayout) learn all of it and have fun with it!