-
Sheet
An important element in iOS is the Sheet. In this post, we will cover: In this example i use this image Unsplash Creating a Non-Full-Screen Sheet Begin by creating the project and adding the image to the assets. I’ve renamed the image to background. First, we add a ‘plus’ button to the toolbar. When this…
-
Navigation Title and Toolbar
We can configure the navigation bar by adding the title and defining how to display it. To achieve this: It is also possible to set the title at the top and center it by adding the display mode like this: The default display mode is automatic, which means the title is displayed large and aligned…
-
NavigationStack & TabView
Often, or perhaps always, we have a hierarchical navigation (NavigationStack) combined with horizontal navigation (TabView). Let’s see how to merge them: We have declared a NavigationStack that contains the TabView. Now, within any of the tabs, we can navigate forward and return. Here is the FirstView: Instead, here is the ThirdView: To achieve this: If,…
-
TabView
One of the changes I like in SwiftUI, released with Xcode 16, is the new way to write a TabView. Now we can write: To have: We can define a View to use in the first tab, for example. Feel free to customize the others as you like. Now in the Tab: We can also…
-
Navigation
The iOS application uses two main components to allow navigation: NavigationStack and TabView. In this post, we’ll focus on the first one. For simplicity, we’ll start by implementing navigation, moving from one view to an empty view. The main component is the NavigationStack. You should define only one NavigationStack in the root view of your…
-
List Search
SwiftUI includes a SearchBar component starting from iOS 15. Start with this code to display a list of vehicles: To implement the search we have to do: Note that the ForEach now iterates over the searchResult, which contains all the vehicles if the searchText is empty, or the search results based on the vehicle’s name…