Category: SwiftUI
-
Building SwiftUI Grids with LazyVGrid and LazyHGrid
In previous chapters we have looked at using stacks, lists and outline groups to present information to the user. None of these solutions, however, are particularly useful for displaying content in a grid format. With the introduction of iOS 14, SwiftUI now includes three views for the purpose of displaying multicolumn grids within a user…
-
A SwiftUI List, OutlineGroup and DisclosureGroup Tutorial
The previous chapter covered the List, OutlineGroup and DisclosureGroup views and explored how these can be used to visually present hierarchical information within an app while allowing the user to selectively hide and display sections of that information. This chapter will serve as a practical demonstration of these features in action through the creation of…
-
An Overview of SwiftUI List, OutlineGroup and DisclosureGroup
The preceding chapters explored the use of the SwiftUI List view to display information to users in an ordered manner. Lists provide a way to present large amounts of information to the user in a navigable and scrollable format. The features of the List covered so far, however, have not introduced any way to display…
-
A SwiftUI NavigationSplitView Tutorial
The previous chapter introduced us to the SwiftUI NavigationSplitView component and described how multicolumn navigation is implemented and configured. This chapter will take what we have learned about NavigationSplitView and use it to create an example iOS app project. About the Project This tutorial will create the three-column split navigation app illustrated in the previous…
-
Multicolumn Navigation in SwiftUI with NavigationSplitView
The NavigationStack and NavigationLink views outlined in the previous chapters are ideal for adding navigation when each destination view needs to fill the entire device screen. While this is generally the preferred navigation paradigm when working on most iOS devices, it doesn’t take advantage of larger display configurations available on the iPad or the iPhone…
-
A SwiftUI List and Navigation Tutorial
The previous chapter introduced the List, NavigationStack, and NavigationLink views and explained how these can be used to present a navigable and editable list of items to the user. This chapter will create a project that provides a practical example of these concepts. About the ListNavDemo Project When completed, the project will consist of a…
-
SwiftUI Lists and Navigation
The SwiftUI List view provides a way to present information to the user in the form of a vertical list of rows. Often the items within a list will navigate to another area of the app when tapped by the user. Behavior of this type is implemented in SwiftUI using the NavigationView and NavigationLink components.…
-
SwiftUI Stack Alignment and Alignment Guides
The chapter entitled “SwiftUI Stacks and Frames” touched on the basics of alignment in the context of stack container views. Inevitably, when it comes to designing complex user interface layouts, it will be necessary to move beyond the standard alignment options provided with SwiftUI stack views. With this in mind, this chapter will introduce more…
-
SwiftUI Data Persistence using AppStorage and SceneStorage
It is a common requirement for an app to need to store small amounts of data which will persist through app restarts. This is particularly useful for storing user preference settings, or when restoring a scene to the exact state it was in last time it was accessed by the user. SwiftUI provides two property…
-
SwiftUI Observable and Environment Objects – A Tutorial
The chapter entitled SwiftUI State Properties, Observable, State and Environment Objects introduced the concept of observable and environment objects and explained how these are used to implement a data-driven approach to app development in SwiftUI. This chapter will build on the knowledge from the earlier chapter by creating a simple example project that uses both…