SwiftUI: Fewer disturbances using DND

Ashish Singh
3 min readJan 12, 2022

Namaste everyone.

I am an ios developer and an ardent learner. It is going to be a series of articles in which I intend to share my learnings about SwiftUI from basic to what I become at the end of the series. Hope to ace it along with you guys. As I believe in “In vain have you acquired knowledge if you have not imparted it to others” — Deuteronomy Rabbah. So let us learn together.

Here I am going to explain the efficiency of SwiftUI with the concept that I would like to introduce as mentioned below:

“SwiftUI: Fewer disturbances using DND”.

So does this mean we get disturbed by the long process and long hours of work? No, of course not. We love to work but what we would love more is to work smarter and quicker so here all it means is to increase our efficiency using the DND feature with Apple’s new framework called SwiftUI. This framework is an amazing upheaval, which is built upon the power of Swift and lets us build user interfaces across all Apple platforms. This framework does not consume our extra time and energy thus making us more productive.

It allows us to build UI for any Apple Device using one set of tools and APIs. SwiftUI functions flawlessly with new Xcode design tools to keep the code and design in sync. This feature of declarative syntax is easy to read and natural to write.

Did you guys miss it? No problem, the full form of DND is hidden in the above paragraph. It stands for:

Declarative Syntax

SwiftUI uses a very expressive syntax that becomes self-explanatory with little experience in the framework. With this, you can simply state what your user interface should do. For example, for a normal text written in bold and with a foreground color to be blue, you would simply write:

Text(“Namaste”)

.fontWeight(.bold)

.foregroundColor(.blue)

Your code is simpler and easier to read than ever before, saving you time and maintenance. This declarative style even applies to complex concepts like animation.

Native on all Apple Devices

SwiftUI is truly native and is introduced to write codes that work efficiently on all the platforms.

It can access all the native functionalities and technologies of any platform and thus delivering an interacting user interface experience and that too at a lightning speed.

Design Tools

As you start working with design canvas, everything you edit is in sync with the code in the adjoining editor. Code is instantly visible as a preview as you type, Xcode keeps on recompiling after every change you make is much faster to preview a single screen than running the app on the simulator after every small change in the code.

Some of the features of the tool are named below:

Drag and drop

Following the old ritual of drag and drop views Apple has again optimized it immensely with the inspector now containing all the modifiers, views, images, snippets, and colors.

Previews

You can now create one or many previews for the UI and test upon different conditions like screen sizes, localization, dark mode, and many more.

Summing up the introduction of the framework here, follow for more.

I will try posting unfailingly.

Keep Learning and help me learn too.

Namaste!

--

--

Ashish Singh

iOS developer with 2+ experience. Like to code. Love building solutions that can be extended with only a few keystrokes.