Getting started with SwiftUI: iOS Development

Neeraj
SwiftUI Forum
Published in
6 min readAug 9, 2021

SwiftUI helps you build great-looking apps across all Apple platforms with the power of Swift — and as little code as possible. With SwiftUI, you can bring even better experiences to all users, on any Apple device, using just one set of tools and APIs.

Here is a table of content for this blog.

Keywords

struct:

Structures and classes are general-purpose, flexible constructs that become the building blocks of your program’s code. You define properties and methods to add functionality to your structures and classes.

var:

Variables associate a name with a value of a particular type. The value of a variable can be set to a different value in the future.

let:

You declare constants with the let keyword like this.

State:

SwiftUI manages the storage of any property you declare as a state. When the state value changes, the view invalidates its appearance and recomputes the body. Use the state as the single source of truth for a given view.

some:

Adding the keyword some in front of a return type indicates that the return type is opaque. For a detailed explanation of some, you can check this medium block.

func:

In swift func is the keyword used for defining functions. Functions could be without Parameters or with parameters. Here is a code snippet for your reference.

Classes

View:

A type that represents part of your app’s user interface and provides modifiers that you use to configure views. You create custom views by declaring types that conform to the View protocol. Implement the required body computed property to provide the content for your custom view.

HStack:

HStack is nothing but a view that arranges its children in a horizontal line.

VStack:

VStack is a view that arranges its children in a vertical line.

HStack:

HStack is a view that overlays its children, aligning them in both axes.

Image:

A view that displays an image. Use an image instance when you want to add images to your SwiftUI app.

Text:

A view that displays one or more lines of read-only text. A text view draws a string in your app’s user interface using a body the font that’s appropriate for the current platform. You can choose a different standard font, like title or caption, using the font(_:) view modifier.

Spacer:

A flexible space that expands along the major axis of its containing stack layout, or on both axes if not contained in a stack. A spacer creates an adaptive view with no content that expands as much as it can.

Group:

Use a group to collect multiple views into a single instance, without affecting the layout of those views, like an HStack, VStack, or Section would. After creating a group, any modifier you apply to the group affects all of that group’s members.

TabView:

A view that switches between multiple child views using interactive user interface elements. To create a user interface with tabs, place views in a TabView and apply the tabItem(_:) modifier to the contents of each tab. On iOS, you can also use the View/badge(_:) modifier to assign a badge to each of the tabs.

Slider:

A slider consists of a “thumb” image that the user moves between two extremes of a linear “track”. The ends of the track represent the minimum and maximum possible values. As the user moves the thumb, the slider updates its bound value.

Map:

A view that displays an embedded map interface. A map view displays a region. Use this native SwiftUI view to optionally configure user-allowed interactions, display the user’s location, and track location.

GroupBox:

Use a group box when you want to visually distinguish a portion of your user interface with an optional title for the boxed content.

Divider:

The Divider is nothing but a visual element that can be used to separate other content. You can see its implementation in the above code snippet.

Link:

Link is a control for navigating to a URL. You create a link by providing a destination URL and a title. The title tells the user the purpose of the link, which can be either a string or a title key that returns a localized string used to construct a label displayed to the user in your app’s UI.

Circle:

A circle is centered on the frame of the view containing it. The circle’s radius equals half the length of the frame rectangle’s smallest edge.

ScrollView:

The scroll view displays its content within the scrollable content region. As the user performs platform-appropriate scroll gestures, the scroll view adjusts what portion of the underlying content is visible. ScrollView can scroll horizontally, vertically, or both, but does not provide zooming functionality.

List:

A container that presents rows of data arranged in a single column, optionally providing the ability to select one or more members.

NavigationView:

Use a NavigationView to create a navigation-based app in which the user can traverse a collection of views. Users navigate to a destination view by selecting a NavigationLink that you provide.

Thanks for reading. If you found this helpful, please share it with your friends.

You can find the full code here.

Did I get something wrong? Mention it in the comments. I would love to improve.
If you liked what you read, please leave some claps!

GoodBye

Thanks for reading. If you found this article to be helpful please share it with your friends.

For more about flutter, follow me, so you’ll get notified when I write new posts.

To know more about me, visit :

https://about.me/nmaurya

--

--