DEV Community

Cover image for Understanding SwiftUI - What is SwiftUI? 🧐
Shivam Maggu
Shivam Maggu

Posted on • Originally published at blog.shivammaggu.com on

Understanding SwiftUI - What is SwiftUI? 🧐

In this concise and no-nonsense article, let's postulate what SwiftUI is and why it is all the hype within the iOS developer community.

Table of Contents

Requirements

  • The minimum deployment target version is iOS 13 and above.

  • SwiftUI development is supported by Xcode version 11 and above.

The basics

  • SwiftUI is a UI Design Framework just like its predecessor, the UIKit.

  • It uses the Declarative programming approach as opposed to Imperative programming.

  • In simple words, we inform the framework of what should be done based on a state change and it handles the rest.

  • Whereas in the Imperative approach, we keep track of the state and instruct the framework on how to change the UI.

  • SwiftUI uses struct to create views instead of class.

Pros

  • SwiftUI helps developers write simple, clean and less code.

  • It manages the state better than the Imperative approach of UIKit.

  • Supports cross-platform development for iOS/iPadOS, macOS, tvOS and watchOS.

  • It uses Live Previews instead of building the project to view UI changes.

  • There are no auto layout issues as it always generates satisfiable layouts.

  • People working in teams no longer have to suffer merge conflicts in storyboards. 😜

  • It can be used alongside UIKit using UIHostingController.

  • It supports reactive programming using ObjectBinding, BindableObject and the Combine Framework.

Cons

  • Users with iOS version 12 and below will not be able to use apps developed with SwiftUI.

  • Team development might take more time as others might not be familiar with SwiftUI.

Sentry blog image

The Visual Studio App Center’s retiring

But sadly….you’re not. See how to make the switch to Sentry for all your crash reporting needs.

Read more

Top comments (0)

Sentry mobile image

Mobile Vitals: A first step to Faster Apps

Slow startup times, UI hangs, and frozen frames frustrate users—but they’re also fixable. Mobile Vitals help you measure and understand these performance issues so you can optimize your app’s speed and responsiveness. Learn how to use them to reduce friction and improve user experience.

Read the guide →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay