Bulleted and numbered lists are not common features in most applications. It is used to highlight information in point form format. This article shows you how to implement it in SwiftUI.
Plus, it is going to show how to use ViewModifier
, Sheet
, and more.
If you are interested in creating a bullet list using UIKit, here is another article.
When can we use a bullet list in an application?
Here are a couple of websites viewing from a mobile device:
A bank application (left) uses a bullet list to highlight their chequing account product.
An automobile application (right) uses a bullet list to show the standard features of a specific vehicle model.
A Simple List
A simple list is just a collection of Text
components embedded inside a VStack
. It is very simple!
The code is very simple!
struct SimpleList: View {
var listItems: [String]
var listItemSpacing: CGFloat? = nil
var body: some View {
VStack(alignment: .leading,
spacing…