111 UIKit vs SwiftUI – Reasons behind Apple’s decision to change to SwiftUI – Decagon Blog
Engineering

UIKit vs SwiftUI – Reasons behind Apple’s decision to change to SwiftUI

Avatar
Boluwatife Adesina
Aug 27, 2021
share
tweeter facebook linkedin
UIKit vs SwiftUI – Reasons behind Apple’s decision to change to SwiftUI
Apple’s Change to SwiftUI

Back in 2019, Apple made the bold decision to create SwiftUI as the natural successor to UIKit and completely shake up the iOS development space. Since it’s announcement, the rate of adoption has been rather slow. Companies are slightly reluctant to make such a drastic change to their already established codebases and so for now, UIKit remains the main way by which iOS apps get made. Eventually however, SwiftUI will take over and it is important to have knowledge of it ahead of time.  This article will look at the reasons behind the introduction of SwiftUI and it’s potential advantages over UIKit. 

A Look Back  

Apple first introduced Swift at WWDC14. A modern rethinking that borrowed a number of ideas from popular languages, Swift was described by Apple as “an industrial-quality programming language that is as expressive and enjoyable as a scripting language.”  

Swift can be used to create UIKit apps for iPhone, iPad, AppleTV and Apple Watch. However the UIKit development API precedes the creation of Swift.  Apple sought to create a framework through which they can harness the true power of Swift. This is where SwiftUI comes in. SwiftUI delivers a refined approach to building the code that drives the look and feel of apps, promising to dramatically increase developer productivity.   

Why SwiftUI? Advantages over UIKit 

SwiftUI makes use of a declarative syntax, whereby developers simply state what their UI should do, similar to JavaScript on the web. This helps create simple, easy to read code that’s also easy to maintain. The declarative style enables a bevy of complex animations, which can be easily added to screens.  

SwiftUI also has a feature similar to the Hot Reload feature available in Flutter, where code is instantly presented in a graphical preview as you type it. This works because XCode recompiles changes instantly and inserts them into a running version of your app, visible and editable at all times. SwiftUI supports drag-and-drop arrangement of UI components within the user interface by simply dragging controls on the canvas. Once placed you can easily rearrange controls or click to open an inspector to select font, color, alignment, and other design options. Even if you prefer hand-coding parts of your interface, you can use inspectors to discover new modifiers for each control. You can drag controls from your library and drop them on the design canvas or directly on the code. 

Summary 

One of the key reasons behind the creation of SwiftUI was the desire for developers to be able to bring more complex ideas to life. SwiftUI makes programming more accessible to a larger audience of users, including people who have an idea for an app but lack the skills to build software. In making its development tools easier to learn and simpler to use, Apple can continue to expand its base of developers globally, offering them the most lucrative store to sell their apps, along with the best accessibility and localizations needed to reach audiences around the world. 

Leave a Reply

Your email address will not be published. Required fields are marked *