SwiftUI

Unlock the power of iOS development and create stunning, responsive user interfaces with our comprehensive guide to learning SwiftUI.

How to present detail view using NavigationLink in SwiftUI?

NavigationLink helps you to present new view or detail view from the navigation view. While using NavigationLink it pushes the a details view on the navigation stack with built in animation. To demonstrate this, the following code creates a DetailView…

How to show date picker in SwiftUI?

SwiftUI date picker is a very handy built-in modifier(DatePicker) for selecting a specific date, time, or both. A date picker has four modes: date, time, date and time, count down timer. You can display date picker in contact, wheels and…

How to show picker in SwiftUI?

SwiftUI’s dedicated picker can display one or more scrollable items from which you can choose your desired item. It is recommended to use pull-down menu instead of a picker if the list is not very long. A picker typically appears…

How to show a menu in SwiftUI?

SwiftUI menu is a versatile control for presenting a menu of actions. It supports submenus and the primary action from iOS 15. SwiftUI menu is more user friendly and advance than the action sheet. Let’s try a menu named “Manage…

How to show a context menu in SwiftUI?

The context menu provides you access to additional functionality related to onscreen items without cluttering the screen. You can create a context menu using .contextMenu modifier. The context menu is triggered with a long press. Each menu item in the…

How to show an action sheet in SwiftUI?

From iOS 15 you can present an action sheet using confirmationDialog() modifier. In SwiftUI, the action sheet shows a confirmation dialogue using data to produce the dialogue’s content and a localized string key for the title. You need to provide…

How to create background blur in SwiftUI?

Glassmorphism is a very trending UI design paradigm nowadays. We can use the semi-transparent blurry background to give more focus on the foreground content. SwiftUI provides .blur() modifier to create the background blur but it has very limited functionality compared…

How to create horizontal or vertical ScrollView in SwiftUI?

ScrollView in SwiftUI presents its content within the scrollable region. ScrollView can scroll horizontally, vertically, or both. The alignment of the ScrollView is vertical. If you want to make it horizontal then you need to use the horizontal parameter for…

Built-in shapes in SwiftUI

Shapes in SwiftUI are a very innovative, exceptionally simple way to build a user interface component. In this article, we will take a look at simple shapes like rectangle, rounded rectangle, ellipse, circle and capsule. The common use of built-in…

How to show an alert in SwiftUI?

iOS 15 makes the alert presentation a piece of cake. You can show an alert using the alert() modifier. Buttons inside the alert will dismiss the alert view when it is tapped. You can create multiple buttons inside an alert.…