The Atomic Theory for humans.

The atom which we know as “the indivisible” is electrons, protons and neutrons. Largely. The protons (positive) and the neutrons(neutral) are at the nucleus, deep within and whirling around it, is…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How SwiftUI Works ? Understanding it

Here i will explain every component from a basic Swift UI Project. This article is recommend for everyone who doesn’t know the elements that compose a swift ui project.

Swift UI is a new recommended way to build users interface from Apple…

The easiest way to Create an SwiftUI App, is starting a new project with interface parameter as SwiftUI.

After that Xcode will create a app structure like that:

Xcode app structure

The Preview

TO RENDER YOUR UI CODE YOU NEED TAP RESUME 🎸

Preview rendered UI from Content View

the preview using the current run destination as a hint for which device to display. For example, Xcode shows the following preview if you’ve selected an iOS target to run on the iPhone 12 Pro Max simulator:

Is a file that contains the code responsible to create UI Elements.

Is the main part of code. Here we will use all SwiftUI components as showed at line 12. Text create a simple text component receiving as parameter the title.

At line 19, we must return the ContentView created above, with it Xcode will automatically discover and generate a Preview for it.

As showed by image below, the decorator @main, declares the entry point of Application, here we must add the first screen of our application, in our case ContentView created at step #3.

Here are some other great tutorials talking about that and others that go on.

I hope this can be help you a understand the SwiftUI App structure and with it you feel able to improve your knowledge about it.

Feel Free to share feedbacks about the content, my english or anything you want.

Add a comment

Related posts:

Five Keys to Producing More and Better Scientific Papers

Scientific papers are the currency of academia. The dream paper tells a compelling story and answers a deep question conclusively.

10 Buah dan Sayuran Untuk Diet Pilihan Ahli Nutrisi

Berat badan adalah masalah yang sering diungkit-ungkit oleh banyak orang. Pola makan yang salah, kurangnya nutrisi, dan konsumsi makanan tidak sehat membuat obesitas makin menghantui. Jika berat…