-
Navigate Programmatically
The classic way to navigate in a SwiftUI application is by using the NavigationStack with NavigationLink. In 99% of cases, this is sufficient. However, in some cases, we may need to navigate programmatically. How can we do that? As we can see, we use a path passed to the NavigationStack. When something is added to…
-
Localization
When you create a successful app, you need to localize the application for users from different countries. To do that in Xcode is simple. In the File menu, choose New and then File from Template, then select the String Catalog and save the file as Localizable. Now, if you run the application, this file will…
-
Splash screen
In this post, we’ll see an object that is present in many popular applications: the Splash Screen. With the storyboard, we have a specific object for that. In SwiftUI, the splash screen is a regular view that we can create however we want. In the example, the splash screen contains a heart that pulses for…
-
Alert
We can display an alert using the .alert modifier. Take a look at the code: The role of the button can be: Note that using a button with .destructive is also added the default cancel button
-
LazyGrid
In SwiftUI we have two powerful and efficient grids to display multiple items: The fundamental element for these types of grids is the GridItem, which can be of three types: GridItem Adaptive GridItem Adaptive is essential for a responsive layout. By setting a minimum size for it, the grid will try to adapt to all…
-
ScrollView – Carousel
Apart from the List, there is another component for creating a scrollable view of items: the ScrollView. This component allows scrolling vertically (by default) and horizontally. To learn how to use this component, we will create a carousel. We often see complex interfaces built using carousel components, as seen on Netflix, Amazon, and others. Let’s…
